mobile.choosePhoto

Lets the user select a picture from the mobile device's photo gallery and returns a picture identifier.

Syntax

ui.Interface.frontCall("mobile", "choosePhoto",
   [], [path])
  1. path - Holds the device opaque path to the chosen photo.

Usage

When displaying the application a mobile device, the "choosePhoto" front call starts the system's photo chooser (the device's photo gallery), allows the user to choose a photo, and returns the path/URL on the mobile device of the chosen photo.

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

If the user cancels the photo chooser, NULL is returned.

Important:

For GMA / Androidâ„¢, using the choosePhoto front call needs the android.permission.READ_EXTERNAL_STORAGE Dangerous Permission 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.