Enabling and disabling vibration in android programmatically
<p>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).</p>

<p>I am currently using the following code with the help of the <strong>deprecated function 
setVibrateSetting</strong></p>

<p>// For turning on the vibration mode</p>

<pre><code>audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
            AudioManager.VIBRATE_SETTING_ON);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
            AudioManager.VIBRATE_SETTING_ON);
</code></pre>

<p>// For turning off the vibration mode</p>

<pre><code>audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER,
            AudioManager.VIBRATE_SETTING_OFF);
audio.setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION,
            AudioManager.VIBRATE_SETTING_OFF);
</code></pre>

<p>But I am wondering if there is a clear way to do this.</p>

<p>And suggestions are most welcome :)</p>

<p>Regards,
Jujare</p>
