Android Cordova 5.0+ camera malfunction

We use Cordova 5.0.0 and its cordova-camera-plugin

When we test it on Android, the application crashes when the user takes a picture. If you look at the links below, it seems that our application is killed when the camera connects to it.

PhoneGap camera restarts application

https://github.com/shaithana/cordova-plugin-wezka-nativecamera

Although there are several answers, they seem to be outdated: the front-end camera plugin is not suitable for new devices or Cordova, and other solutions do not work for us

Does anyone have a modern solution?

+5
source share
2 answers

Try using this forked cordova-android and cordova-plugin-camera .

Documents, examples and discussion of the approach used can be found in the Android PR codec.

BTW, PR will be merged soon.

+3
source

The first question that comes to mind: why is the plugin using this camera: https://github.com/shaithana/cordova-plugin-wezka-nativecamera

This is obviously a fork. You may have a good reason. It is also out of date. The last installment was a year ago.

Perhaps you want to give a shot to the "official" plugin: https://github.com/apache/cordova-plugin-camera

Going into details, not knowing more about your testing environment (which device is the Android version using it) and not being able to view all the code related, is not possible, and the answers cannot give any reliable recommendations for change.

Have you ensured that the camera plug-in cannot be called before "deviceready" has been started? Is cordova.js loaded?

Update: You can also switch from raw warnings to console output. I have learned several times that warnings in callbacks caused by plugins can cause some problems.

Typically, use console.log() instead of alert() and connect to Chrome (chrome: // inspect) on the emulator or device to see what happens. You can optionally use adb logcat to view the device log.

0
source

Source: https://habr.com/ru/post/1235466/


All Articles