Jump to content
Poweramp
Sign in to follow this  
DulcetTone

Pausing music by broadcast intent

Recommended Posts

This does not appear to have any effect on music playback. Am I using it incorrectly?

void pausePowerAMP(Context context) {

Intent intent = new Intent(PowerAMPiAPI.ACTION_API_COMMAND);

intent.putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.PAUSE);

context.sendBroadcast(intent);

}

tone

Share this post


Link to post
Share on other sites

It's not broadcast, but intent sent directly to service:

startService(new Intent(PowerAMPiAPI.ACTION_API_COMMAND).putExtra(PowerAMPiAPI.COMMAND, PowerAMPiAPI.Commands.PAUSE));

Please check poweramp_api_example sources, esp. MainActivity.onClick() method.

Thanks!

Share this post


Link to post
Share on other sites

Thanks for that.

FYI, the comment in the file indicates sendBroadcast is the way to go, which was the basis of my misunderstanding:

/**

* Poweramp Control action.

* Should be sent with sendBroadcast().

* Extras:

* - cmd - int - command to execute.

*/

public static final String ACTION_API_COMMAND = "com.maxmpz.audioplayer.API_COMMAND";

Thanks for publishing your API.

tone

Share this post


Link to post
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.

Sign in to follow this  

×
×
  • Create New...