Accessing device functions

Mobile apps can access device functions by using front calls.

Accessing device functions using frontcalls

Mobile applications typically want to acces device functions such as geolocation, multi-media content (photos, videos), messaging (contacts database, email, sms).

This can be easily achieved by using front calls dedicated to mobile features. Note that some functions are platform specific, for example to launch an Android activity, or access to iOS device settings.

As a general rule, execute your front call in a TRY / CATCH block to catch errors:
DEFINE status STRING,
       latitude, longitude FLOAT
TRY
    CALL ui.Interface.frontCall("standard", "getGeolocation",
         [], [status, latitude, longitude] )
CATCH
    ERROR "Could not get coordinates..."
END TRY

For more details, see Genero Mobile common front calls, Genero Mobile Android front calls, Genero Mobile iOS front calls.

Accessing Android device functions using the Java Interface

On Android devices, some system functions can only be accessed in the context of a JVM. Use the Java Interface with the com.fourjs.gma.vm.FglRun class to access such system specifics. Custom Java classes need to be part of the .apk package and can be used without any further configuration.