Prevent phone vibration when switching to RINGER_MODE_VIBRATE

117 views Asked by At

I have an app that toggles ringer mode on schedule. Everething works fine, but after updating to Android 6 phone start making short vibration when switching from ring mode to vibrate mode. Vibration similar to the one when the user manually reduces the volume to the minimum.
Maybe someone has an idea how to avoid it? Nexus 5, Android 6.0.1.
Default code:

AudioManager audioManager = (AudioManager) getBaseContext().getSystemService(Context.AUDIO_SERVICE);
audioManager.setRingerMode(AudioManager.RINGER_MODE_VIBRATE);
1

There are 1 answers

0
craned On

You might consider controlling the vibration yourself, and setting it to vibrate for zero milliseconds. Check these links to find what you need.

https://developer.android.com/reference/android/os/Vibrator

https://developer.android.com/reference/android/os/VibrationEffect