Play from shell using 'am'

App version: 2.3.2 (7b87b9cd0) F-Droid

Android version: 11 LineageOS 18

Device model: OnePlus 5

I’d would like to if I command could Play, Pause etc by intent or service using the am command. I see that AntennaPod has a service core.service.playback.PlaybackService, Can I do with that or something?

I have root.

What are you trying to do? If you want to use automation apps like Tasker, you should be able to just use the “send media button” feature.

Thanks for your reply, you are right, but I actually want to use with MacroDroid, unfortunately MacroDroid does not have ‘send media button’ action. Though it does Shell action, so I wonder if AntennaPod play can be triggered with am service or something

Something like this should work:

am start-foreground-service --ei de.danoeh.antennapod.core.service.extra.MediaButtonReceiver.KEYCODE 127 de.danoeh.antennapod/de.danoeh.antennapod.core.service.playback.PlaybackService

where the keycode is one of the following:

Action Keycode
Play 126
Pause 127
Fast forward 90
Rewind 89
Skip 272

That’s not officially supported, though :wink: It’s usually better to use the “media button” action when possible in the automation app.

Thanks a lot :heart: That works