breautek commented on issue #1733: URL: https://github.com/apache/cordova-android/issues/1733#issuecomment-2310047403
> Hi i'm trying to keep active my app to read my fcm notification using tts and to play media once fcm notification received if app is killed or closed or terminated, i tried so many methods it doesn't work for me so please help me to fix this issue and i attached my code ... and is there anyother way to keep active like headless Android does not make any guarantee under any circumstance to keep your activity alive, especially once it goes into the background. If you need code running in the background the native way is to create background services, as services are are detached from the activity and can live beyond an activity's lifecycle. For context for those who are unfamiliar with android naive terms, an `activity` is the "frontend"/UI object that the user can see and interact with. a `ForegroundService` is a background service in which has UI but in a form of a notification entry, therefore you're very limited to what can actually be displayed. Cordova runs entirely in an activity where it manages a webview. When app's activity is destroyed, so is cordova and all of it's plugins and by extension, the entire webview environment. To do what you want, you need to write a lot of native code to setup and launching native services where your business logic is within these services. This "setup" code can be exposed via the cordova plugin so that it runs (or you command it to run in your app) so that the service is launched when the activity/webview runs, but you'll need to add your app's business logic in these plugins on the native side so that they run **in** the service instead of the android activity. Because you're using media playback, a `ForegroundService` is necessary I believe. If you want it to interact with FCM the service code itself will probably need to interface with FCM, but I'm not familiar with FCM enough to give any specific suggestions. I'm closing this issue because it doesn't detail a bug with Cordova. If you have any more questions, please use [GitHub Discussions](https://github.com/apache/cordova/discussions). -- 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