breautek commented on issue #918:
URL: 
https://github.com/apache/cordova-plugin-camera/issues/918#issuecomment-2496154003

   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](https://github.com/apache/cordova-plugin-camera?tab=readme-ov-file#android-quirks)
 with a 
[link](https://cordova.apache.org/docs/en/dev/guide/platforms/android/index.html#lifecycle-guide)
 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](https://github.com/apache/cordova-contribute/blob/master/create-reproduction.md)
 app that can demonstrate the issue.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@cordova.apache.org
For additional commands, e-mail: issues-h...@cordova.apache.org

Reply via email to