mobile.takePhoto

Lets the user take a picture with the mobile device and returns the corresponding picture identifier.

Syntax

ui.Interface.frontCall("mobile", "takePhoto",
   [], [path] )
  1. path - Holds the device opaque path to the picture that has been taken.

Usage

When displaying the application a mobile device, the "takePhoto" front call invokes the mobile device's camera to let the user take a picture and returns the local path/URL on the mobile device to the picture.

On desktop, this front call will open the file selector, to chose a file from the storage unit.

If the photo is canceled by the user, the front call returns NULL.

Important:

For GMA / Androidâ„¢, using the takePhoto front call needs the android.permission.CAMERA, android.permission.READ_EXTERNAL_STORAGE and android.permission.WRITE_EXTERNAL_STORAGE Dangerous Permissions to be specified when building the APK. See Android permissions for more details.

The value returned in the path variable contains a reference to the system location of the picture on the mobile device. This path is platform dependent, and may change in future versions. Consider the path returned by this front call as an opaque local file identifier, and do not use this path as a persistent filename for the picture.

Once the photo identifier/path is known, it is possible to fetch the photo file from the device to the program context with the fgl_getfile() API. The procedure is similar to fetching photos from the device. For more details about mobile image handling, see images handling on mobile devices.