Poweramp Start Playlist on Bluetooth connection

Post your questions and help other users.

Moderator: Martin

Post Reply
neocoma504
Posts: 3
Joined: 06 Mar 2020 10:03

Poweramp Start Playlist on Bluetooth connection

Post by neocoma504 » 07 Mar 2020 10:08

Hello,

I am facing difficulties in a new flow i'd like to create. The purpose would be to launch a particular Poweramp playlist in Shuffle mode automatically at a selected hour (for alarm clock).

My difficulties comes for the Poweramp part. The easiest way i think would have been to use the shortcut function of Poweramp, which can select a Playlist to launch and activate shuffle.
Unfortunately, while this shortcut function works from my Nova launcher, i cannot select it in Automagic (or in any other automation apps). I think there is something wrong about path description with shortcut method used by Poweramp dev. But no answer from Poweramp forum about this...

Anyway looking at Automagic forums i found some interesting thread talking about Poweramp Action Start Activity API and it seems there may be a way here to launch the playlist directly.
But i think i'm not dev skilled enough to understanf how to use this API in Automagic to select and launch a playlist in shuffle thru Automagic.
Could someone help me on this ?

Here is the link of the Poweramp APIs
https://github.com/maxmpz/powerampapi/b ... mpAPI.java

Thanks

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Poweramp Start Playlist on Bluetooth connection

Post by Desmanto » 08 Mar 2020 15:27

Try to use Automagic action Launch Shortcut > Build Shortcut. Select music playlist and select the playlist. Execute it and when prompt, choose poweramp and pick always. This should work and much easier.

I don't exactly understand the API there. But I found the tasker method of using service, equivalent to action Start Service in Automagic.

Start Service
Action : com.maxmpz.audioplayer.API_COMMAND
Data URI : content://com.maxmpz.audioplayer.data/playlists/1/files
Extra

Code: Select all

putInt("cmd", 9);
replace 1 with the playlist index. If you create and delete the index, there is probably gaps in numbering.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

neocoma504
Posts: 3
Joined: 06 Mar 2020 10:03

Re: Poweramp Start Playlist on Bluetooth connection

Post by neocoma504 » 09 Mar 2020 08:48

Hi

Thanks for your help.
As i mentioned the Shortcut action is not possible for me with Poweramp, because when i try to build the shortcut inside the Launch Shortcut action, i get the prompt for selecting the playlist and shuffle mode, but then nothing happen and the path stay empty. I think the problem is related to Poweramp's method to create shortcut as this is not working with any other automation app neither and i saw some similar issues on poweramp forums.

So i've looked a little more at API and with your help i succeeded to have what i wanted (i was mis-using the extras section in my previous attempts).

For info i had to change some things
-there must be a "cmd"=20 in extra to actually start the playlist selected in Data URI
-the "cmd"=9 in extra cycles thru all shuffle options without specifying a shuffle mode (so it depends on previous shuffle state). So for specifying a mode (shuffle songs in my case); i have to add a "shuffle"=2 extra.
-for a reason i ignore if a put all the commands in the same action, only the shuffle mode command works, the playlist doesn't start. Same if i create two actions in serial ("shuffle mode" then "start playlist") directly. But by adding a Sleep action between these two, it works ! (1s sleep is enough)
-Also i read on poweramp forum that the shuffle mode command may not work if the app is put to sleep by Android OS after an inactivity period. At the same time Poweramp doesn't seem to answer to API commands when shown in front of device. So i added a chain of ( Launch App (Poweramp) / Sleep 3s / Show Home Screen / Sleep 1s ) before the shuffle and playlist to wake up the app and close (without killing) before addressing the intended commands. Maybe there would be an easiest way to "activate" the app from without having it show up?

Also for the playlist ID, it was easy for me as i only have 1 playlist in Poweramp. But for those looking for playlists IDs, there is an app called "New Playlist Manager", which when put in in List mode shows the ID used by Poweramp.

User avatar
Desmanto
Posts: 2709
Joined: 21 Jul 2017 17:50

Re: Poweramp Start Playlist on Bluetooth connection

Post by Desmanto » 09 Mar 2020 10:00

Too bad the playlist shortcut doesn't work. It is working at minilyric, launch shortcut will be populated with the shortcut from the playlist and play it when executed. Maybe you need to enable some extra permission for Automagic or Poweramp in order to make it work. I have granted all grantable permission to Automagic, don't know if that make difference.

If you already can send shuffle command, then you only need to play it. Try to use action Control Audio Player, Play, send to specified app, choose PowerAmp. You can try broadcast method too if Poweramp doesn't appear on the app list.
Index of Automagic useful thread List of my other useful posts (and others')
Xiaomi Redmi Note 5 (whyred), AOSP Extended v6.7 build 20200310 Official, Android Pie 9.0, Rooted.

Post Reply