apache / cordova-plugin-camera

Apache Cordova Plugin camera
https://cordova.apache.org/
Apache License 2.0
966 stars 1.55k forks source link

POCO MIUI 13.0.5 ionic camera plugin is crashing while capturing image #815

Open Anushaanureddy opened 1 year ago

Anushaanureddy commented 1 year ago

Issue Type

Description

POCO MIUI 13.0.5 ionic camera plugin is crashing while capturing an image in the application, Do any solutions for this from anyone? Please share the solution here.

Environment, Platform, Device

Ionic:

Ionic CLI : 5.4.16
Ionic Framework : @ionic/angular 5.5.2 @angular-devkit/build-angular : 0.1000.8 @angular-devkit/schematics : 10.0.8 @angular/cli : 10.0.8 @ionic/angular-toolkit : 2.3.3

Cordova:

Cordova CLI : 11.0.0 Cordova Platforms : android 10.0.0, browser 6.0.0 Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 5.0.0, (and 21 other plugins)

Utility:

cordova-res : not installed native-run : 1.7.1

System:

Android SDK Tools : 26.1.1 NodeJS : v12.20.0 npm : 6.14.8 OS : Windows 10

Checklist

potocnikj commented 1 year ago

We've recently been experiencing similar crashes on random android devices. We also use Cordova CLI 11.0.0, cordova-android 10.

We're not yet sure what to do. But it surely looks like some android version isn't compatible with camera plugin, as crashes didn't start with a new version, but randomly with ever bigger frequency.

breautek commented 1 year ago

For what it's worth (Not sure if this information is relevant for this issue), Cordova uses the Android's Intent system. It's a way of delegating responsibilities to another app, which is the recommended approach that Google suggests. It's mainly used so that users don't need to give explicit permissions to dangerous (privacy sensitive) APIs to several apps, like the Camera permissions/APIs. Instead, apps can use the Intent system to effectively open an existing app to handle a specific task, such as a delegated Camera app to capture images on the behalf of another app.

At the basic level this should work with pretty much any Camera app, however more advanced features like cropping, or resizing images can cause issues depending on the camera app in use or how the user chooses which image format they use.

If the camera app allows you, I'd try experimenting with different camera settings (in the camera app itself), for example if it gives you a choice, try using an older/common format like PNG or JPG to see if it solves your issue.

If you're using the allowEdit option in the Cordova API, it is known to be defective as support is not guaranteed by the underlying Camera application, so try disabling it.

Anushaanureddy commented 1 year ago

I have tried setting the allowEdit as false and the format set is for PNG and JPG itself, still no luck on the issue. But all of a sudden it works well and crashes again while accessing the camera within the application.

On Mon, Nov 7, 2022 at 8:10 PM Norman Breau @.***> wrote:

For what it's worth (Not sure if this information is relevant for this issue), Cordova uses the Android's Intent https://developer.android.com/reference/android/content/Intent system. It's a way of delegating responsibilities to another app, which is the recommended approach that Google suggests. It's mainly used so that users don't need to give explicit permissions to dangerous (privacy sensitive) APIs to several apps, like the Camera permissions/APIs. Instead, apps can use the Intent system to effectively open an existing app to handle a specific task, such as a delegated Camera app to capture images on the behalf of another app.

At the basic level this should work with pretty much any Camera app, however more advanced features like cropping, or resizing images can cause issues depending on the camera app in use or how the user chooses which image format they use.

If the camera app allows you, I'd try experimenting with different camera settings (in the camera app itself), for example if it gives you a choice, try using an older/common format like PNG or JPG to see if it solves your issue.

If you're using the allowEdit option in the Cordova API, it is known to be defective as support is not guaranteed by the underlying Camera application, so try disabling it.

— Reply to this email directly, view it on GitHub https://github.com/apache/cordova-plugin-camera/issues/815#issuecomment-1305713525, or unsubscribe https://github.com/notifications/unsubscribe-auth/AJOH2JAV2F7UITSKTCKNSVTWHEIF7ANCNFSM6AAAAAARVDTJNA . You are receiving this because you authored the thread.Message ID: @.***>