正在播放音频下,退出登录或被挤下线等情况下,就要遇到下列情况
问题:播放时设置服务前台运行,创建一个消息通知栏
- service.startForeground(NOTIFICATION_ID, new Notification());
解决办法:服务停止在前台运行,再清空通知栏
- service.stopForeground(true);
- notificationManager.cancelAll();//从命名就知道是,清空全部。当然也可以根据Notification的ID来相应关闭
service 表示 播放service对象
NOTIFICATION_ID 表示 Notification的ID,即通知的标识符
notificationManager 表示 NotificationManager对象
如果播放service还没关闭就再调用一次mPlayer.pause()