In one of my android apps, I need to enable or disable the vibration completely irrespective of the mode (i.e. silent or general or loud).
I am currently using the following code with the help of the deprecated function setVibrateSetting
// For turning on the vibration mode
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_ON);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_ON);
// For turning off the vibration mode
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
AudioManager.VIBRATE_SETTING_OFF);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
AudioManager.VIBRATE_SETTING_OFF);
But I am wondering if there is a clear way to do this.
And suggestions are most welcome :)
Regards, Jujare