How to play or resume music of another music player from my code

前端 未结 2 896
栀梦
栀梦 2021-01-31 06:04

In my Android app I want to play or resume the played music after I pause it. I got my app to pause the music by sending a broadcast, but I can\'t get it to play or resume the m

2条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-31 06:42

    Try to use

    Intent i = new Intent("com.android.music.musicservicecommand");
    i.putExtra("command", "togglepause");
    sendBroadcast(i);
    

    Update

    Try with the following action :

    Intent i = new Intent("com.android.music.musicservicecommand.togglepause");
    i.putExtra("command", "togglepause");
    sendBroadcast(i);
    

提交回复
热议问题