/**
* 停止音乐播放
*
* @param context
*/
public static void pauseMusic(Context context) {
if (context == null) {
return;
}
Intent freshIntent = new Intent();
freshIntent.setAction("com.android.music.musicservicecommand");
freshIntent.putExtra("command", "pause");
context.getApplicationContext().sendBroadcast(freshIntent);
}
/**
* 播放音乐
*
* @param context
*/
public static void playMusic(Context context) {
Intent freshIntent = new Intent();
freshIntent.setAction("com.android.music.musicservicecommand");
freshIntent.putExtra("command", "togglepause");
context.getApplicationContext().sendBroadcast(freshIntent);
}
Andorid_当前应用停止其他应用播放音频
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。