Capacitor: bug: Cannot "continue" in Android Camera Edit window

Created on 23 Oct 2019  路  4Comments  路  Source: ionic-team/capacitor

Bug Report

Capacitor Version

馃拪 Capacitor Doctor 馃拪

Latest Dependencies:

@capacitor/cli: 1.2.1
@capacitor/core: 1.2.1
@capacitor/android: 1.2.1
@capacitor/ios: 1.2.1

Installed Dependencies:

@capacitor/cli 1.1.0
@capacitor/android 1.2.1
@capacitor/core 1.1.0
@capacitor/ios 1.2.0

Affected Platform(s)

  • [x] Android
  • [ ] iOS
  • [ ] Electron
  • [ ] Web

Current Behavior

When allowEditing is true in the Camera .getPhoto call, on Android, there is no option to select the edited image. Basically you can only close the edit window and it doesn't pass the image back to JS.

Expected Behavior

Should work like iOS where you can crop etc and then continue and have the edited image returned.

Sample Code or Sample Application Repo

image000000

Reproduction Steps

      let options: any = {
        quality: 80,
        correctOrientation: true,
        allowEditing: true,
        direction: CameraDirection.Front,
        resultType: CameraResultType.DataUrl
      };

      return Camera.getPhoto(options).then(res => {

        if (typeof res === 'object' && res.dataUrl) resolve(res.dataUrl);
        else reject();

      }).catch(() => reject());

Other Technical Details

npm --version output: 6.10.3

node --version output: v9.4.0

pod --version output (iOS issues only): ---

Other Information

Most helpful comment

For what it's worth - this is what I ended up doing:

const image = await Camera.getPhoto({
    quality: 90,
    allowEditing: Capacitor.platform === 'ios',
    direction: CameraDirection.Front,
    source: CameraSource.Prompt,
    resultType: CameraResultType.Base64,
    width: 750
  });

This way Android doesn't take you to some editing app, but just returns the image. iOS allows simple edits and it is straightforward. Much better experience.

All 4 comments

iOS behaviour comes with the native component, Android uses an Intent to a photo editing app. The app in your screenshot I think is google photos app and works like that, don't let you continue until you do some change to the image. If in example you tap "auto", the continue button will appear.
We can't control the photo editing app.

Isn't there an open source photo capture/edit library that could be used so that the functionality is consistent or at least usable across platforms? Also the ability to take a photo without leaving the app would eliminate a lot of complexity in terms of restoring state, etc. Relying on the raw android functionality doesn't seem to provide usability in this case. Even though you can tap auto and maybe continue appears at that point, our testers couldn't figure that out, which means that it's unusable as is.

https://github.com/CameraKit/camerakit-android

https://github.com/aminography/ChoosePhotoHelper

https://github.com/gm4s/MediaPickerInstagram

For what it's worth - this is what I ended up doing:

const image = await Camera.getPhoto({
    quality: 90,
    allowEditing: Capacitor.platform === 'ios',
    direction: CameraDirection.Front,
    source: CameraSource.Prompt,
    resultType: CameraResultType.Base64,
    width: 750
  });

This way Android doesn't take you to some editing app, but just returns the image. iOS allows simple edits and it is straightforward. Much better experience.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

stripathix picture stripathix  路  3Comments

Kepro picture Kepro  路  3Comments

peterpeterparker picture peterpeterparker  路  3Comments

gnesher picture gnesher  路  3Comments

nicobytes picture nicobytes  路  3Comments