View RSS Feed

LianjaDev

Developing PWA Apps in Lianja

Rate this Entry
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.

Code:
Lianja.getVideo(onsuccess, onerror, controlsource, containerid, append, keyfield, keyfieldvalue, includefiles)
Audio recording

Capture and upload audio recordings. The controlsource may be table.column format or filename.rsp to handle custom uploads.

Code:
Lianja.getAudio(onsuccess, onerror, controlsource, containerid, append, keyfield, keyfieldvalue, includefiles)
Custom upload handler on the server

The following example can be used.

Code:
<%@ 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
%>
Vibration

The Vibration API enables web apps to make a mobile device vibrate.

Code:
Lianja.vibrate(secs)
Audio Feedback

Code:
Lianja.beep()
Orientation

The DeviceOrientationEvent gives information about the physical orientation of the user's device.

Code:
orientationchanged App delegate
Lianja.getOrientation()
Geolocation

The Geolocation API enables users to share their location with a web app.

Code:
devicemotionchanged App delegate
getCurrentPosition(onsuccess, onerror)
Device motion

The DeviceMotionEvent gives information about the speed of changes for the position and orientation of the user's device.

Code:
devicemotionchanged App delegate
Lianja.getCurrentAcceleration(onsuccess, onerror)
Network info

The NetworkInformation API provides information about the connection of a device, allowing web apps to adapt functionality based on network quality.

Code:
connectionchanged App delegate
Lianja.getConnection()
Multi touch

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.

Code:
Lianja.getFiles(onsuccess, onerror, controlsource, adding, keyfield, keyfieldvalue)
Payment

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:

Name:  Screen Shot 2021-03-09 at 10.54.21 AM.jpg
Views: 1498
Size:  37.9 KB

Submit "Developing PWA Apps in Lianja" to Google Submit "Developing PWA Apps in Lianja" to Facebook Submit "Developing PWA Apps in Lianja" to Twitter

Updated 2021-11-29 at 05:45 by barrymavin

Tags: None Add / Edit Tags
Categories
LianjaDev

Comments

Journey into the Cloud
Join us