设置振铃和振动模式同时播放

时间:2015-04-04 13:07:47

标签: android audio-streaming volume android-audiomanager

应该怎么做才能实现STREAM_RING(或STREAM_NOTIFICATION,或STREAM_ALARM,或STREAM_SYSTEM,或STREAM_DTMF)与振动一起振铃的情况?

我的意思是有办法设置

AudioManager am=(AudioManager)getSystemService(AUDIO_SERVICE);
am.setRingerMode(AudioManager.RINGER_MODE_NORMAL|AudioManager.RINGER_MODE_VIBRATE);

或者,如果我设置,例如,

AudioManager am=(AudioManager)getSystemService(AUDIO_SERVICE);
am.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);

am.setStreamVolume(
                    AudioManager.STREAM_NOTIFICATION,
                    am.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION),
                    0);
am.setStreamVolume(
                    AudioManager.STREAM_ALARM, 
                    am.getStreamMaxVolume(AudioManager.STREAM_ALARM), 
                    0);
am.setStreamVolume(
                    AudioManager.STREAM_RING, 
                    am.getStreamMaxVolume(AudioManager.STREAM_RING), 
                    0);
am.setStreamVolume(
                    AudioManager.STREAM_SYSTEM, 
                    am.getStreamMaxVolume(AudioManager.STREAM_SYSTEM), 
                    0);
am.setStreamVolume(
                    AudioManager.STREAM_DTMF, 
                    am.getStreamMaxVolume(AudioManager.STREAM_DTMF), 
                    0);

这个动作是否有效,我在等什么?

0 个答案:

没有答案