我試圖改變通知量,但不是鈴聲。 但是,當我使用此功能通知和鈴聲音量改變。android.media.AudioManager.setStreamVolume(int streamType,int index,int flags)
示例代碼:
AudioManager mAudioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
int volNot = mAudioManager.getStreamVolume(STREAM_NOTIFICATION);
int volRing = mAudioManager.getStreamVolume(STREAM_RING);
Log.d(volNot + "," + volRing, "not, ringer");
mAudioManager.setStreamVolume(STREAM_NOTIFICATION, 1, 0);
volNot = mAudioManager.getStreamVolume(STREAM_NOTIFICATION);
volRing = mAudioManager.getStreamVolume(STREAM_RING);
Log.d(volNot + "," + volRing, "not, ringer");
對於結果setStreamVolume(STREAM_NOTIFICATION, 1, 0)
變化notifications(STREAM_NOTIFICATION)
到1的值,但它也改變的ringer(STREAM_RING)
值爲1