android中音频开发中出现的问题

来源:互联网 发布:骷髅头音乐软件 编辑:程序博客网 时间:2024/05/16 17:42

1.明明将系统的Notiication声音设置为mute,但是还是会出现一点点声音

我是这样写的代码:

    @Overrideprotected void onResume() {       super.onResume();       mMediaManager.setNotificationMute();    Logs.logI("onResume", this);}         @Overrideprotected void onPause() {        new Handler().postDelayed(new Runnable() {@Overridepublic void run() {mMediaManager.setNotificationUnmute();}}, UNMUTE_NOTIFICATION_DELAY_TIME);    super.onPause();}   

这样写的代码解决了问题。出现问题的时候,是这样写的代码;

    @Overrideprotected void onPause() {    mMediaManager.setNotificationUnmute();super.onPause();}  

分析了一下,如果因为播放的时长,有点长,大约时2秒。而系统将notification警告从mute模式,调成非mute模式,要不了2秒。所以会出现尾音的情况,所以加个延迟就行了。

0 0