PaulWoitaschek / Voice

Minimalistic audiobook player
GNU General Public License v3.0
2.43k stars 370 forks source link

[Feature Request] Keep notification while paused #868

Closed datajosh closed 4 years ago

datajosh commented 5 years ago

Currently, once you pause a book, the notification from Voice disappears relatively quickly. My wife and I both use the app regularly and think it would be better to keep the notification until dismissed, similar to the way Google Play Music, YouTube, and other media players handle it. It would be much more convenient than having to return to the app to resume playing.

GangsterEmpire1 commented 5 years ago

Yes, I would like this feature as well. When pausing the audiobook the notification widget & lockscreen widget disappears quickly. After that you can't resume the audiobook without unlocking phone and opening the Voice app and pressing play. I also tried setting Voice battery management settings (Android) to manual so that the background activity of the Voice app is not restricted but it didn't help.

abguymon commented 5 years ago

Just wanted to +1 this request. It used to stay longer but it drives me nuts how quickly it disappears now.

PaulWoitaschek commented 5 years ago

The system kills the service quite quickly because I call stop foreground upon playback paused: https://github.com/PaulWoitaschek/Voice/blob/21480cbb71a2318eecf0949967cdcf87a00984e9/app/src/main/java/de/ph1b/audiobook/playback/PlaybackService.kt#L235

This is because I want the user to be able to swipe-dismiss the notification in paused state. If the service stays foreground this doesn't work.

At least that's what I remember, if you find a fix for that, that would be great. The other quirk is that because the service needs to be started as a foreground service: https://github.com/PaulWoitaschek/Voice/blob/0bd5aa9bb2b0d71e59a68a71aa17b855bc52c2ab/app/src/main/java/de/ph1b/audiobook/playback/events/MediaEventReceiver.kt#L20 It must not stop itself immediately else it will crash. So we create this dummy notification which for some users stays persistent for some reason.

innesst commented 5 years ago

This may or may not be related, but I notice that recently, and without using the app or having any interaction with it, upon restarting my phone -or- exiting from airplane mode, the notification appears and I must swipe away.

nioncode commented 5 years ago

It should be possible to keep the notification around after stopping the foreground service. Apparently Voice gets killed pretty fast by the system, while other apps like Pocket Casts or Play Music keep their notification alive (on my phone the entire day) after being paused and do not get killed.

Maybe there is some design pattern on Android that allows this kind of notification handling, but I couldn't find it in a quick research, maybe others have more luck, since it is quite annoying that the notification does not persist.

PaulWoitaschek commented 5 years ago

It already works on master

nioncode commented 5 years ago

Sweet, let's close this then.

yhack commented 4 years ago

Seems like there are actually two different feature requests here.

  1. Keep the Voice notification while paused.
  2. Keep the Voice lockscreen widget while paused.

On my device, the first feature works but the second does not. If I pause the audio while my device is locked and allow the screen to go off, I have to unlock the device before I can start audio playback again. Any chance of supporting the second feature request?

PaulWoitaschek commented 4 years ago

@yhack which Android version are you using? In case it's 10 you need to pull down your notification area.

yhack commented 4 years ago

@PaulWoitaschek I have Android 8.0.0 on a Galaxy s7 Edge. When I pull down the notification area on the lock screen after pausing there's nothing there, yet when I unlock the phone Voice is in the notification area.

yhack commented 4 years ago

I found an answer to (2). It seems to apply to any media player but may be specific to the Galaxy s7 (Edge) on Android 8.0.0.

When you pause the music (or whatever media), the player seems to disappear. But, while on the > lockscreen, if you swipe to the left, the player will be there and you can resume playing.

https://forums.androidcentral.com/android-8-0-oreo/901925-media-players-disappear-when-i-press-pause-lock-screen.html

Confirmed this annoying behavior doesn't exist in stock Android 10 in an emulator.