homerours / cordova-music-controls-plugin

A Cordova plugin displaying music controls in notifications (cordova-plugin-music-controls)
MIT License
155 stars 190 forks source link

MusicControls notification doesn't notice app being killed #53

Open tkem opened 7 years ago

tkem commented 7 years ago

I noticed that the MusicControls notification keeps getting shown when my app is "killed" by Android after a period of inactivity. If the app is "paused", i.e. put in the background, and I terminate it manually (by swiping it from the recent apps list), the MusicControls notification is closed after a short delay (1-3 sec). If I keep it in the background, e.g. over night, the app will get killed silently at some time. Apparently, MusicControls does not notice this, and prev/play/next buttons will no longer work. Clicking the track image will restart the app, splash screen and all, though.

homerours commented 7 years ago

Hello, Thank you for this precise description. I experienced the same issue, but I was not able to find a proper solution :( There is a "notification killer service" in the plugin that should kill the notification when the app dies. It seems that the service detects when the user manually kills the app, but not when the system does it after some time ...

tkem commented 7 years ago

I'm by no way an expert in Android system programming, but if I understand correctly, Android may literally "kill" an app running in the background at any time without further notice. Since this doesn't seem to trigger the "notification killer service", I can think of two possible solutions:

As I said, I don't know much about Android native programming, so I don't know if my proposed solution/workaround is feasible in any way...