Developing PWA Apps in Lianja
by
, 2021-11-02 at 08:55 (9745 Views)
A Progressive Web App (PWA) is a website that can be installed on your device and provide an app-like experience.
What is a Lianja PWA? Learn more here.
Lianja supports a wide range of functionality for building Progressive Web Apps (PWA).
Media capture
Media capture allows apps to use the camera and microphone of a device. After recording a video you can play it, download it or record another one.
Capture and upload photos. The controlsource may be table.column format or filename.rsp to handle custom uploads.
Code:Lianja.getPhoto(onsuccess, onerror, controlsource, containerid, append, keyfield, keyfieldvalue, includefiles)
Capture and upload videos. The controlsource may be table.column format or filename.rsp to handle custom uploads.
Audio recordingCode:Lianja.getVideo(onsuccess, onerror, controlsource, containerid, append, keyfield, keyfieldvalue, includefiles)
Capture and upload audio recordings. The controlsource may be table.column format or filename.rsp to handle custom uploads.
Custom upload handler on the serverCode:Lianja.getAudio(onsuccess, onerror, controlsource, containerid, append, keyfield, keyfieldvalue, includefiles)
The following example can be used.
VibrationCode:<%@ Language="VFP" %> <% // Authentication as admin or verify APIKEY if username() != 'admin' if getenv("DB_APIKEY") != getmember("_server", "HTTP_LIANJAAPIKEY", "") ? "Nok incorrect APIKEY " + username() return endif endif // The _FILES array contains details of the file that was uploaded cc=len(_FILES) if cc > 0 m_name = _files[ 1 ].name m_name = str_replace("'", "", m_name) m_name = basename(m_name) m_tmpname = _files[ 1 ].tmp_name if endsWith(m_name, ".png") or ; endsWith(m_name, ".jpg") or ; endsWith(m_name, ".jpeg") or ; endsWith(m_name, ".gif") // We can use move_uploaded_file() to safely move the uploaded file to where we want it saved // alternatively we can open a database and table and insert a new record // specifying the filename as the "Blob" field value // // move_uploaded_file(m_tmpname, "images/"+m_name) // ? "Ok" else ? "Nok prohibited file type" endif else ? "Nok no files specified" endif %>
The Vibration API enables web apps to make a mobile device vibrate.
Audio FeedbackCode:Lianja.vibrate(secs)
OrientationCode:Lianja.beep()
The DeviceOrientationEvent gives information about the physical orientation of the user's device.
GeolocationCode:orientationchanged App delegate Lianja.getOrientation()
The Geolocation API enables users to share their location with a web app.
Device motionCode:devicemotionchanged App delegate getCurrentPosition(onsuccess, onerror)
The DeviceMotionEvent gives information about the speed of changes for the position and orientation of the user's device.
Network infoCode:devicemotionchanged App delegate Lianja.getCurrentAcceleration(onsuccess, onerror)
The NetworkInformation API provides information about the connection of a device, allowing web apps to adapt functionality based on network quality.
Multi touchCode:connectionchanged App delegate Lianja.getConnection()
This is handled in page, section and formitem gesture delegates
gestureswipeleft
gestureswiperight
gestureswipeup
gestureswipedown
gesturepan
gesturepinch
gesturetap
gesturetapandhold
File System
Choose and upload files. The controlsource may be table.column format or filename.rsp to handle custom uploads.
PaymentCode:Lianja.getFiles(onsuccess, onerror, controlsource, adding, keyfield, keyfieldvalue)
The Payment Request API provides a browser-based method to enable users to make payments on the web, using a credit card, Apple Pay or Google Pay for example.
Code:Lianja.makePayment(onsuccess, onerror, supportedMethods, supportedNetworks, supportedTypes, orderID, shoppingCart)
Example: