react-native-track-player icon indicating copy to clipboard operation
react-native-track-player copied to clipboard

[Feature Request] Bring back ability to remove notification

Open mpivchev opened this issue 3 years ago • 3 comments

There have been a lot of complains recently of the media notification being shown always and never going away. We originally decided to not hide the notification at all, but it seems like this has been pretty controversial.

Looking at other apps, Spotify used to not hide its media notification either, but it seems like it has been updated recently to do so. Google Podcasts never hides its media notification even if you remove the app from recents.

Beyond that, the device manufacturer can override this and do whatever they want with the notification. For example, on my Nokia all media notifications disappear no matter what the developer intended.

Sadly, in Android it looks like there is no 100% set standard of handling media notifications. I find this pretty annoying, but it's the way android works...

Considering this, we can add a flag for users to choose whether or not they want to hide the notification once the app is removed from recents: stoppingAppRemovesNotification. Note that this will have to override the other flag we have: stoppingAppPausesPlayback, as it's not possible to have persistent audio playing while the media notification is gone. That is because we set our service as foreground (aka important and hard to kill, except for super bad states like out of memory errors), and for that android requires a notification is always present to notify the user there is an almost unkillable app in the background doing stuff.

We may want to reconsider our flags and combine them into one function. For example: setStoppingAppPausesPlayback(true, alsoRemovesNotification = true)

mpivchev avatar Sep 08 '22 15:09 mpivchev

I think it's a good idea use a flag for different behavior. When use setStoppingAppPausesPlayback(true) the media notification could removed and the service stopped when kill app from recent list, instead when set it to false the service could be played even the app was killed (like Google Podcast). But the major difference between Google Podcast and this library is that when stop audio from notification after app was killed the notification become dismissable and you able to kill service. I don't know if it is an unexpected behavior from my device but when kill this lib the notification is always there and the only way to dismiss that is to terminate app from setting

filippobusi avatar Sep 09 '22 09:09 filippobusi

when you'll fix this problem, is there an estimated time?

efeakyuz avatar Sep 12 '22 14:09 efeakyuz

Please track https://github.com/doublesymmetry/react-native-track-player/pull/1730

jspizziri avatar Sep 14 '22 14:09 jspizziri