On Android 10
I am trying to disable the vibration for "Ring Volume".
So I am trying to reach the state on the image, which I can reach via the UI - programmatically.
- Disabled vibration of Ring Volume
- Do not Disturb mode off
Problem:
I tried using the AudioManager.setRingerMode()
Its spec says:
/**
* Sets the ringer mode.
* <p>
* Silent mode will mute the volume and will not vibrate. Vibrate mode will
* mute the volume and vibrate. Normal mode will be audible and may vibrate
* according to user settings.
* <p>This method has no effect if the device implements a fixed volume policy
* as indicated by {@link #isVolumeFixed()}.
* * <p>From N onward, ringer mode adjustments that would toggle Do Not Disturb are not allowed
* unless the app has been granted Do Not Disturb Access.
* See {@link NotificationManager#isNotificationPolicyAccessGranted()}.
* @param ringerMode The ringer mode, one of {@link #RINGER_MODE_NORMAL},
* {@link #RINGER_MODE_SILENT}, or {@link #RINGER_MODE_VIBRATE}.
* @see #getRingerMode()
* @see #isVolumeFixed()
*/
public void setRingerMode(int ringerMode) {
Sound like it would be the way to reach the state on the image.
But the code below activates the "Do not Disturb" mode. Which despite of disabling the Vibration also has a lot of other effects: suppress the notifications etc. which I do not want to activate.
See image below
final AudioManager audio = (AudioManager) mContext.getSystemService(mContext.AUDIO_SERVICE);
audio.setRingerMode(AudioManager.RINGER_MODE_SILENT);
Is the state on the picture above - unreachable programmatically?
According to this thread - Enable Silent Mode in android without triggering Do Not Disturb it is unreachable?
Do not DIsturb activates on RINGER_MODE_SILENT