Plugins.Photos not implemented for android?

Hello,

I am working on a Galley component within an app that runs on Capacitor. I am using the Plugins.Photos.getPhotos() method to retrieve the images. Works okay for iOS, but on Android error is returned message: "not implemented".

Is it ready only for iOS? Why would it be released to prod for only one platform? Is there an ETA on the Android part?

Or am I doing something wrong? This is the code that works fine for iOS, but not on android.

Thanks, alex.

/**
 * @description Getting the device photos via Capacitor
 */
private async getImagesFromDevice() {
    await Plugins.Photos.getPhotos({ quantity: this.limit }).then(({ photos }) => {
        this.photos = photos;
    });
}

Only available on iOS at the moment.

I’d recommend using the Camera API instead. See this guide. To open the photo gallery, you’d use CameraSource.Photos, like so:

const image = await Plugins.Camera.getPhoto({
      quality: 100,
      allowEditing: false,
      resultType: CameraResultType.DataUrl,
      source: CameraSource.Photos
    });
3 Likes

Thanks for the response Matt.

The solution you have provided is what we currently use in our app, but unfortunately if doesn’t support multiple photo selection. At least for android it does not.

Can we expect the plugin to be available at any time for android?

Thanks for the clarifications!
Alex.

You’re welcome.

Not aware of any plans to work on this in the near term. That said, Capacitor’s open to the community, so PRs are welcome. You can track status of issues and new releases here.

This code opens the camera instead of the gallery. I’ve tried CameraSource.Prompt as well, which also opens the camera instead of the gallery.

Any idea what I’m doing wrong?

import {Camera, CameraResultType, CameraSource} from "@capacitor/core";

const image = await Camera.getPhoto({
      quality: 90,
      allowEditing: false,
      resultType: CameraResultType.Base64,
      source: CameraSource.Photos
    });
1 Like