You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Bug Report
Problem Description
Expected Behavior
To be able to take photos using the camera.
Actual Behavior
After Clicking Photo, App RESTARTS,
Related Information
Reproduction Steps:
Launch the app.
Activate the camera function and tap the capture button.
After Clicking Photo, App RESTARTS,
Additional Context or Information:
Device: Redmi Note 9 Pro, Vivo Max
What you're describing sounds like an expected flow when using Intents, which is the Android mechanism of delegating a task to another application (e.g. the Camera).
Why is this a thing?
When the camera intent is launched, and the camera application is launched, it puts your app activity (The "thing" that holds your application's UI) in the background. The OS may kill the activity if it believes it's necessary for smooth operation of the foreground application. The exact details of how Android decides this is not known to us, and can probably vary by device hardware configuration and installed applications.
What can be done?
But nonetheless the OS killing the activity is an expected workflow that should be handled. It's quirk is documented here with a link containing more details about the android lifecycle.
How can I test this?
You can force android to always use this flow for testing purposes by enabling the Don't Keep Activities developer option on the device, which will make Android always kill background activities.
Other notes
A note on this background mode thing you've mentioned, which I assume is provided by cordova-plugin-background-mode plugin. It appears to setup a ForegroundService. A Service is something that an Activity can start, and can run in the background, independently from the activity. It's useful in native development to perform background task that might be long-running. a ForegroundService is a specific kind of service that allows UI to be displayed in the notification center. So that the service can provide progress feedback to the user. It's not that useful in Cordova applications because most of your state is inside the web application, which cannot be decoupled from the webview, and thus cannot be decoupled away from the activity.
Services cannot keep an activity alive in the background, but a service can continue running after the activity is destroyed. It has no relevance to how the application behaves when using Intents.
If you can confirm if this is what you are experiencing, please let me know.
Otherwise if you still think there is a bug, we'll likely need a sample reproduction app that can demonstrate the issue.
Bug Report
Problem Description
Expected Behavior
To be able to take photos using the camera.
Actual Behavior
After Clicking Photo, App RESTARTS,
Related Information
Reproduction Steps:
Launch the app.
Activate the camera function and tap the capture button.
After Clicking Photo, App RESTARTS,
Additional Context or Information:
Device: Redmi Note 9 Pro, Vivo Max
Operating System: Android 12, 13
cordova plugin list
backgroundapprun 0.0.1 "backgroundAppRun"
cordova-background-geolocation 4.15.0 "BackgroundGeolocation"
cordova-plugin-android-permissions 1.1.5 "Permissions"
cordova-plugin-app-version 0.1.9 "AppVersion"
cordova-plugin-background-fetch 7.2.4 "CDVBackgroundFetch"
cordova-plugin-background-mode 0.7.3 "BackgroundMode"
cordova-plugin-camera 8.0.0 "Camera"
cordova-plugin-console 1.1.0 "Console"
cordova-plugin-device 2.0.2 "Device"
cordova-plugin-dialogs 2.0.1 "Notification"
cordova-plugin-file-opener2 3.0.5 "File Opener2"
cordova-plugin-file-transfer 1.7.1 "File Transfer"
cordova-plugin-file 6.0.2 "File"
cordova-plugin-firebasex 14.0.0 "Google Firebase Plugin"
cordova-plugin-inappbrowser 3.0.0 "InAppBrowser"
cordova-plugin-ionic-keyboard 2.2.0 "cordova-plugin-ionic-keyboard"
cordova-plugin-ionic-webview 5.0.0 "cordova-plugin-ionic-webview"
cordova-plugin-network-information 3.0.0 "Network Information"
cordova-plugin-splashscreen 5.0.2 "Splashscreen"
cordova-plugin-statusbar 2.4.2 "StatusBar"
cordova-plugin-streaming-media 2.3.0 "StreamingMedia"
cordova-plugin-vibration 3.1.0 "Vibration"
cordova-plugin-whitelist 1.3.5 "Whitelist"
cordova-plugin-x-socialsharing 6.0.4 "SocialSharing"
cordova-plugin-x-toast 2.7.3 "Toast"
es6-promise-plugin 4.2.2 "Promise"
Command or Code
$scope.showActionSheet = function () {
console.log("LOG Action Sheet !");
$ionicPopup.show({
title: 'Upload Image',
subTitle: '',
scope: $scope,
buttons: [
{ text: '
Camera
' ,onTap: function(e) {
$scope.openCameraTEST();
}
},
]
});
};
Environment, Platform, Device
Platform: Android
Device: Redmi Note 9 Pro, Vivo Max
Version Information
Cordova: Cordova Android 13.0.0
Operating System: Android 12, 13
Checklist
Searched for existing GitHub issues.
Included all the necessary information above.
Problem :
WHILE USING BACKGROUND MODE IN TARGET - SDK 34,
SOME PHONES WITH ANDROID 12, 13, WORKS FINE WITHOUT USING BACKGROUND MODE,
BUT SOME some phones App reloads, no error in LOGCAT of Android Studio,
App just restarts. Error happening in very few devices
The text was updated successfully, but these errors were encountered: