Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Cordova: App restarting after using the camera

I'm working on a mobile app using ionic framework. When I try to work with the cordova camera plugin (to take pictures or access the gallery) the app restarts.

I've found many forum threads and questions here about the subject, and the most useful one was this one: PhoneGap camera restarts the application

This question is 4 years old, and I think the solutions given are no longer compatible with newer version of cordova.

Is there any new solutions to the problem? I've been stuck for 3 days with this.

like image 534
younes sofiane Avatar asked Mar 12 '23 06:03

younes sofiane


1 Answers

The question you mention may be 4 years old, but the issue remains the same: Android is killing off your Cordova app activity while it has been put in the background and the camera activity is in the foreground (see the Cordova documenation for a detailed explanation of the issue).

The essence of the accepted answer to that question is also still correct, but the plugins mentioned are out-of-date / have not been updated for new versions of Cordova.

I would suggest using one of the more recently updated forks (e.g https://github.com/zebra1024/cordova-plugin-wezka-nativecamera) of cordova-plugin-wezka-nativecamera as the foreground camera plugin, since the original repo hasn't been updated in 2 years and has issues with the latest versions of Cordova.

like image 181
DaveAlden Avatar answered Mar 19 '23 02:03

DaveAlden