Vinayak Bevinakatti
Vinayak Bevinakatti

Reputation: 40503

Android - Toggle Notification volume programmatically

A Checkbox found in the Ringer Volume settings that allows you to set a separate Notification volume and incoming call volume

Is there a way to Check/Uncheck the Check box for Notification volume programmatically.

Upvotes: 1

Views: 3127

Answers (2)

Christopher Orr
Christopher Orr

Reputation: 111565

There is a hidden but editable preference in the Settings.System class that determines whether the notification volume is tied to the ringer volume.

It's called NOTIFICATIONS_USE_RING_VOLUME and is marked in the source code as hidden, with the well-commented reason that it will be removed from the platform at some point in the future.

The setting has an integer value of 0 if ringer and notification volumes are independent; 1 otherwise.

Upvotes: 6

Christopher Orr
Christopher Orr

Reputation: 111565

I don't recall seeing an API to do this, but you could try altering the notification (or ringer) volume programmatically to see whether that lets it "break free" of the ringer volume.

See AudioManager.adjustStreamVolume(STREAM_NOTIFICATION, ADJUST_RAISE, 0).

Upvotes: 0

Related Questions