I have been using the cordova-plugin-media-capture plugin for some time now without any problems on Android and iOS.
Except under Android 9 or after closing the camera (with or without video to return) the webview restarts.
I searched everywhere in the github issues of the plugin and on this forum but without success...
I also have trouble understanding what's happening with the logs because as soon as the application restarts I have the process that switch to "DEAD" status and so I no longer have the logs in Android Studio.
I may have help with
https://developer.android.com/about/versions/oreo/android-8.0-changes#back-all
or https://developer.android.com/about/versions/pie/android-9.0-changes-28
I would like to point out that this does not work even if I disable battery optimization from the parameters.
Here was the code I use :
var captureSuccess = function(mediaFiles) {
// didn't reach this code
}.bind(this);
var captureError = function(error) { };
navigator.device.capture.captureVideo(captureSuccess, captureError, {limit:1, duration:60});
Did you have any ideas?
EDIT 1 :
At the end of the README of cordova-plugin-media-capture we can read this :
When capturing audio, video, or images on the Android platform, there is a chance that the application will get destroyed after the Cordova Webview is pushed to the background by the native capture application.
I'm affraid about it cause i use ExtJS framework which are unable (or i don't know how) to save and restore state at the resume event... Do you know how to avoid the apps to be destroyed ?