Jump to content

Pausing music by broadcast intent


DulcetTone

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

Link to comment
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!

Link to comment
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

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...