1.明明将系统的Notiication声音设置为mute,但是还是会出现一点点声音
我是这样写的代码:
@Override
protected void onResume() {
super.onResume();
mMediaManager.setNotificationMute();
Logs.logI("onResume", this);
}
@Override
protected void onPause() {
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
mMediaManager.setNotificationUnmute();
}
}, UNMUTE_NOTIFICATION_DELAY_TIME);
super.onPause();
}
这样写的代码解决了问题。出现问题的时候,是这样写的代码;
@Override
protected void onPause() {
mMediaManager.setNotificationUnmute();
super.onPause();
}
分析了一下,如果因为播放的时长,有点长,大约时2秒。而系统将notification警告从mute模式,调成非mute模式,要不了2秒。所以会出现尾音的情况,所以加个延迟就行了。