Jump to content

Bring Poweramp to the front


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 much appreciate your contribution. My app relies heavily on the api and there is so much to read and understand. I have found that when max does not respond it usually  means the answer is there so this might be it. I will check my code and experiment a little

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...