开发者

Android notification and ringer volumes, a question

开发者 https://www.devze.com 2023-01-11 09:35 出处:网络
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

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();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号