Skip to content Skip to sidebar Skip to footer

Change Output Volume In Broadcastreceiver For Notification For Non-streaming Preference

WhatsApp seems to always notify me with high volume when running in the background and one of my contacts (who has a custom notification sound) comes up. I'm trying to create a sim

Solution 1:

Hmm, did you try this? (yes its using an audio stream but it should work)

private AudioManager mAudioManager;
private Context ctxt;

mAudioManager = (AudioManager)ctxt.getSystemService(Context.AUDIO_SERVICE);

int streamVolume = mAudioManager.getStreamMaxVolume(AudioManager.STREAM_NOTIFICATION);

mAudioManager.setStreamVolume(AudioManager.STREAM_NOTIFICATION, streamVolume, 0);

Post a Comment for "Change Output Volume In Broadcastreceiver For Notification For Non-streaming Preference"