This is not the latest version of this document; to access the latest version, click here.

HowTo: Using PhotoLibraryAPI external object for Smart Devices

Official Content
This documentation is valid for:

The Photo Library API enables you to interact with the photo gallery of the device.

As the CameraAPI external object enables an app to interact with the photo camera of the device, this API allows the application to save or get an image from the native photo gallery.

This article focuses on what this API does and gives an example of how to use it in a Smart Device API.

Step 1: External Object

The API has one external object as the image shows.



ChooseImage This method invokes the native photo gallery app and lets the user choose one image to use in the application.
Save The Save method enables the application to store an image on the device's native photo gallery application.


There are three cases of different types of images for which the save method can be used.

a. To save an image from the DB (attribute)

b. To save an image from an URL(ImageVariable.FromURL(url))

c. To save an image just taken with the camera (CameraAPI)

Step 2: Code Sample

Create the following Panel object.




Event Refresh
Event 'GetFromLibrary'
    &getFromLibrary = PhotoLibraryAPI.ChooseImage()
Event 'saveFromURL'


&saveToLibFromWeb -> Image data type
&getFromLibrary -> Image data type

Step 3: Execution

When the GetImage method is invoked:

photolibraryios1    photolibraryios2    photolibraryios3

The SaveImage method has no UI interaction to show, but the result of the execution is the image of the url saved on the device's photo gallery.



  • Implemented in iOS for GeneXus X  Evolution 2 Upgrade 1 and later.
  • Implemented in Android and Black Berry for GeneXus X Evolution 2 Upgrade 2 and later.