Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/image/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何暂停和播放android本机音乐播放器_Android - Fatal编程技术网

如何暂停和播放android本机音乐播放器

如何暂停和播放android本机音乐播放器,android,Android,我将从我的应用程序中播放一些通知警报。。此时,系统应暂停设备中运行的音乐。为此,我将发送广播事件以暂停媒体 Intent audioIntent = new Intent("com.android.music.musicservicecommand.pause"); MYActivity.sendBroadcast(audioIntent); 此代码仅用于暂停Google Play Music和默认音乐播放器。。但这段代码不适用于Poweramp和VLC。。请发布您的解决方案。

我将从我的应用程序中播放一些通知警报。。此时,系统应暂停设备中运行的音乐。为此,我将发送广播事件以暂停媒体

    Intent audioIntent = new Intent("com.android.music.musicservicecommand.pause");
    MYActivity.sendBroadcast(audioIntent);

此代码仅用于暂停Google Play Music和默认音乐播放器。。但这段代码不适用于Poweramp和VLC。。请发布您的解决方案。

请将评论发布给那些贬低我问题的人…我只使用了这些行。。。该行仅适用于默认玩家。不是功率放大器或vlc。。检查更多时间。。。
 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);