Hi Gaurav_ch
Thanks for the quick reply…
I base it on the fact that my Java cordova camera plugin starts again, while it has a static variable check for isInit true / false… If the Java code would be running in the same scope, it would have seen it was created before, and should not do anything else than restart the RTSP stream… But when I resume the app, it restarts from beginning, breaking the other camera instance (there can only be one focus on the camera)…
So my previous ‘paused’ instance starts throwing errors, and another instance says everything is fine, thus there should be 2 instances… Also, if it would resume the ‘background’ instance, it should fire the cordova resume event, which it does not…
When I re-open the app through the ‘active apps overview’ in Android, everything works fine… The cordova resume event is triggered, the java code sees its been init before and continues as programmed.
Very simplified code, not much more going an then triggering the cameraStream:
<script type="text/javascript">
var started = false;
function startStream() {
//var textValue = document.getElementById("myText").value;
cameraStream.startStream("HOI");
}
function onDeviceReady() {
console.log("Device ready");
console.log('started: ' + started);
started = true;
startStream();
}
function onDevicePause() {
console.log("Device pause");
}
function onResume() {
console.log('Device onResume');
}
function onBackButtonPressed() {
console.log('Device backButtonPressed');
}
function endCallButtonPressed() {
console.log('Device backButtonPressed');
}
document.addEventListener("deviceready", onDeviceReady, false);
document.addEventListener("pause", onDevicePause, false);
document.addEventListener("resume", onResume, false);
document.addEventListener("backbutton", onBackButtonPressed, false);
document.addEventListener("endcallbutton", endCallButtonPressed, false);
</script>
From the most simple perspective, I created a global JS variable in the index.html, called ‘started’… But it always returns false when opening from the home-screen icon… Shoudn’t that log ‘true’ when returning after being paused?