Request for dev help (Quick Settings tile)

I’m trying to add a Quick Settings Tile to quickly toggle play/pause. So far I’ve got the tile to successfully play & pause using the same technique as for the widget. Here’s the code for the TileService:

Now I need to switch the tile between active & inactive whenever playback starts or stops.

  1. TileService.requestListeningState() needs to be called whenever playback starts or stops (which then triggers onStartListening() so the tile can be updated). Would it make sense to do this within LocalPSMP.playMediaObject(), or is there a better spot?
  2. When onStartListening() is called (to update the tile), it doesn’t come with any information, so I need to check the current playback status (playing/paused) in order to set the tile to active or inactive. What’s the best way to get the current playback status? (I’ve looked at PlaybackService, PlayerStatus, and PlaybackServiceMediaPlayer, but I’m hoping someone can point me in the right direction.)


Hi, I’m curious about your use case here. Doesn’t the notification bar already show an AntennaPod section that can control playback? Why do we need the quick settings tile as well? :slight_smile:

(Side note: might this bd related to Round widget · Issue #5465 · AntennaPod/AntennaPod · GitHub)

Thanks ByteHamster!

I’ve recently switched to a phone with OneUI 4, which is mostly great except for notifications and the lock screen. The Media Output notification/widget is very unpredictable — sometimes it shows up, sometimes it doesn’t, sometimes you have to tap the clock to find it (which seems like an insane design decision), sometimes it’ll show my music app, sometimes it’ll show AntennaPod, and usually it’ll close one or both of them if they’ve been paused for more than a couple of seconds. As a result, I generally have to tap or swipe around for a while before I can just hit play.

(From what I’ve read, this seems to be an Android and/or OneUI problem, nothing to do with AntennaPod specifically. I’ve turned off “Adaptive battery” and disabled battery restrictions for AntennaPod.)

The music app I’m using (Musicolet) has a QS Tile and I find it very useful and reliable. It does take an extra swipe to show it (compared to just a notification), but at least I know it’ll always be there. Tapping the tile toggles play/pause, and a long-press will bring up the Now Playing activity. It doesn’t add any extra clutter to the actual app interface, because you’d only find it by going into your QS Tile menu.

So I thought I could try out replicating this for AntennaPod and see how people felt. Totally understand if it doesn’t get added to the app, but if I can make it work correctly on my own fork it would be super useful to me.

(Not related to Issue #5465 but thanks as well keunes)

1 Like

Right, I didn’t know what a ‘Tile’ referred so assumed it was a 1x1 widget, but now I see :slight_smile:

I would say that given this is a workaround for standard Android functionality that’s not working on some manufacturer’s software, I would indeed be sceptical about adding it.

This should normally not be helping/relevant in your situation, but wanted to have it mentioned just in case: there’s also a ‘persistent playback controls’ setting - have you turned that on as well?

For what it’s worth, these problems with Android 11+ media control notifications seem to be common enough (example thread, another, and I’ve found a lot more while trying to find a fix). And yes, I have Persistent Playback Controls turned on, but thanks.

Would either of you have any interest in giving me some advice on the two questions above, even if the functionality never gets integrated into the app? Even just some hints would help. It would be much appreciated!

1 Like

Int not a developer so won’t be of any help for your two questions, sorry. I bet ByteHamster will reply when he has the time.

Good point. I’m not 100% sure if the feature is important enough to justify the additional code complexity (and maintenance overhead) but I wouldn’t say I’m against adding it.

I think this would better fit into mediaPlayerCallback.statusChanged() in PlaybackService. Otherwise playing on Chromecast won’t update the tile.

I think something like PlaybackService.isRunning && PlaybackPreferences.getCurrentPlayerStatus() == PlaybackPreferences.PLAYER_STATUS_PLAYING should work

Thanks very much ByteHamster, that seems to have worked perfectly! And thanks to both of you for the feedback. I’ve submitted a PR in case you’d like to consider adding it. Either way, thanks for all of the work to manage a great app.


This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.