Jump to content

Bring Poweramp to the front


flyingdutchman

Recommended Posts

@maxmp Music Playlist Manager  (MPM) accesses the Poweramp media database  to manage playlists etc.

One of the functions it offers is to play a playlist or track which works fine BUT  as MPM is the active app and has the UI, Poweramp itself remains in the background

Is it at all possible to bring Poweramp into full view replacing MPM, using some api call.?

 

Link to comment
Share on other sites

I have absolutely no clue about what I'm writing about... I just got intrigued by the API and trying to understand what can and can't be done... I stumbled upon https://github.com/maxmpz/powerampapi/blob/master/poweramp_api_lib/src/main/java/com/maxmpz/Poweramp/player/PowerampAPI.java

And the following caught my eye:

 
/**
* Sent by your app to Poweramp<br>
* Opens main screen<br>
* Should be sent with Context.startActivity
*/

public static final String ACTION_OPEN_MAIN = "com.maxmpz.audioplayer.ACTION_OPEN_MAIN";

No idea if this would do what you are asking for or if it's something else.

Link to comment
Share on other sites

@6b6561 after a little further searching, this now works as intended.  I just needed the first paragraph too. Thank you for pointing me in the right direction

public void playSelectedPlaylist(Context mContext, long playlist_id) {
   Intent intent = new Intent(PowerampAPI.ACTION_OPEN_MAIN)
         .setClassName(PowerampAPIHelper.getPowerampPackageName(mContext), PowerampAPI.ACTIVITY_STARTUP);
   mContext. startActivity(intent);

   PowerampAPIHelper.sendPAIntent(mContext, new Intent(PowerampAPI.ACTION_API_COMMAND)
         .putExtra(PowerampAPI.EXTRA_COMMAND, PowerampAPI.Commands.OPEN_TO_PLAY)
         .setData(PowerampAPI.ROOT_URI.buildUpon()
               .appendEncodedPath("playlists")
               .appendEncodedPath(Long.toString(playlist_id))
               .appendEncodedPath("files")
               .build()),FORCE_API_ACTIVITY);

}

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...