Android notification and ringer volumes, a question
The Android phones have a setting that allows you to force the notification volume to match the ringer volume, I can't seem to find that sett开发者_Python百科ing anywhere in SDK, can someone help me find out how to get and set it that specific setting?
You have to use setAudioStreamType(AudioManager.STREAM_RING) in MediaPlayer Class http://d.android.com/reference/android/media/MediaPlayer.html#setAudioStreamType(int)
MediaPlayer mediaPlayer = new MediaPlayer();
mediaPlayer.setDataSource(...)
mediaPlayer.setAudioStreamType(AudioManager.STREAM_RING);
mediaPlayer.prepare();
mediaPlayer.start();
精彩评论