Search code examples
androidandroid-audiomanagervibration

android ringing vibration activate/deactivate


I can't find a way I can activate and deactivate the vibration at the time of incoming calls.

The option in the menu --> Settings --> Sounds & Display mentions - PHONE VIBRATE - vibrate phone for incoming calls...

I want to activate and deactivate it through code (if possible).


Solution

  • Have a look AudioManager:

    http://d.android.com/reference/android/media/AudioManager.html

    and setRingerMode/setVibrateSetting:

    http://d.android.com/reference/android/media/AudioManager.html#setRingerMode(int)

    http://d.android.com/reference/android/media/AudioManager.html#setVibrateSetting(int, int)