Skip to content

Photos

Provides access to your photo library.

In order to read from your photo library, you must grant the app access to your photo library. The first time you use the APIs, the app will prompt for access but if you deny the request, all API calls will fail. In that case you must enable access to the photo library from the system settings.

+fromLibrary

Presents the photo library for picking an image.

static fromLibrary(): Promise<Image>

Use this for picking an image from the photo library.

Return value

Promise
Promise that provide the selected image when fulfilled.


+fromCamera

Opens the camera for taking an image.

static fromCamera(): Promise<Image>

Use this for taking a new image using the camera.

Return value

Promise
Promise that provide the captured image when fulfilled.


+latestPhoto

Get latest photo.

static latestPhoto(): Promise<Image>

Reads the latest photo from your photo library. If no photo is available, the promise will be rejected.

Return value

Promise
Promise that provides the photo when fulfilled.


+latestPhotos

Get latest photos.

static latestPhotos(count: number): Promise<[Image]>

Reads the latests photos from your photo library. If no photo is available, the promise will be rejected.

Parameters

count
number
Number of photos to fetch.

Return value

Promise<[Image]>
Promise that provides the photos when fulfilled.


+latestScreenshot

Get latest screenshot.

static latestScreenshot(): Promise<Image>

Reads the latest screenshot from your photo library. If no screenshot is available, the promise will be rejected.

Return value

Promise
Promise that provides the screenshot when fulfilled.


+latestScreenshots

Get latest screenshots.

static latestScreenshots(count: number): Promise<[Image]>

Reads the latests screenshots from your photo library. If no screenshot is available, the promise will be rejected.

Parameters

count
number
Number of screenshots to fetch.

Return value

Promise<[Image]>
Promise that provides the screenshots when fulfilled.


+removeLatestPhoto

Removes latest photo.

static removeLatestPhoto()

Before removing the photo, an alert is shown prompting you to confirm the removal.


+removeLatestPhotos

Removes latest photos.

static removeLatestPhotos(count: number)

Before removing the photos, an alert is shown prompting you to confirm the removal.

Parameters

count
number
Number of photos to remove.


+removeLatestScreenshot

Removes latest screenshot.

static removeLatestScreenshot()

Before removing the screenshot, an alert is shown prompting you to confirm the removal.


+removeLatestScreenshots

Removes latest screenshots.

static removeLatestScreenshots(count: number)

Before removing the screenshots, an alert is shown prompting you to confirm the removal.

Parameters

count
number
Number of screenshots to remove.


+save

Save an image.

static save(image: Image)

Saves the image to the photo library.

Parameters

image
Image
The image to save.