设置声音震动:
am.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,AudioManager.VIBRATE_SETTING_OFF);
AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
录制视频的时候来电铃声不响
VideoModule.java
private int notifacationVolum = 0;
private int ringtoneVolum =0 ;
private int ringtoneMute = AudioManager.RINGER_MODE_NORMAL;
private void setOtherStream(){
AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
ringtoneMute = am.getRingerMode();
ringtoneVolum = am.getStreamVolume(AudioManager.STREAM_RING);
notifacationVolum = am.getStreamVolume(AudioManager.STREAM_NOTIFICATION);
if(notifacationVolum >0){
am.setStreamMute(AudioManager.STREAM_NOTIFICATION, true);
}
if(ringtoneVolum >0){
am.setStreamMute(AudioManager.STREAM_RING, true);
}
}
public void resetOtherStream(){
AudioManager am = (AudioManager)mActivity.getSystemService(Context.AUDIO_SERVICE);
if(notifacationVolum >0){
am.setStreamMute(AudioManager.STREAM_NOTIFICATION, false);
}
if(ringtoneVolum >0){
am.setStreamMute(AudioManager.STREAM_RING, false);
}
}
releaseMediaRecorder(){
//方法中添加 resetOtherStream();
}