| Built-in front calls / Genero Mobile Android front calls | |
Ask the user to enable a dangerous feature on the Android device.
ui.Interface.frontCall("android","askForPermission",
[permission], [result])
The "askForPermission" front call opens a message box to let the end user confirm the access to a "dangerous" Android permission, in order to enable a risky feature of the mobile device for the current app.
The permissions parameter defines the Android permission to be asked. It must be a string representing one of the Android permission contants, as defined in Android's Manifest permissions, prefixed by the "android.permission." string. For example, the "android.permission.WRITE_EXTERNAL_STORAGE" string can be used to identify the permission to access the SDCARD storage unit.
The front call will raise a runtime exception if the permission identifier is not valid.
The following code example asks the user to access the SDCARD, and handles the user choice:
DEFINE result STRING
CALL ui.Interface.frontCall(
"android", "askForPermission",
["android.permission.WRITE_EXTERNAL_STORAGE"],
[result] )
CASE result
WHEN "ok"
CALL os.Path.mkDir("/sdcard/myfiles")
WHEN "rejected"
ERROR "SDCARD access was denied by user"
END CASE