我会从我的应用中播放一些通知提醒..当时系统应该暂停设备中运行的音乐。为此,我发送广播事件暂停媒体。
Intent audioIntent = new Intent("com.android.music.musicservicecommand.pause");
MYActivity.sendBroadcast(audioIntent);
此代码仅用于暂停Google Play音乐和默认音乐播放器..但此代码不适用于Poweramp和VLC ..请发布您的解决方案..
答案 0 :(得分:-2)
You really should supply the code you have written for the broadcast, this is a very hard question to answer without your code... Something like this is what most people use:
Intent i = new Intent("com.android.music.musicservicecommand");
i.putExtra("command", "pause");
YourApplicationClass.this.sendBroadcast(i);