I\'m making a vibrate toggling widget (in fact, its first version is already in the Market) but I\'m having some problems with the vibrate settings of Android 2.2.
U
Ok, I think I finally fixed it.
I looked at the source code of the com.android.settings.Settings
class and copied part of the methods that enable and disable vibrate:
https://android.googlesource.com/platform/packages/apps/Settings/+/master/src/com/android/settings/SoundSettings.java
Thank you anyway magaio, you pointed me in the right direction.
I had to mess with these settings myself when some application messed up my Nexus One's individual settings. Here they are:
Always vibrate on ring:
setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ON);
Never vibrate on ring:
setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_OFF);
Vibrate on ring in silent only:
setVibrateSetting(AudioManager.VIBRATE_TYPE_RINGER, AudioManager.VIBRATE_SETTING_ONLY_SILENT);
Always vibrate on notify:
setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ON);
Never vibrate on notify:
setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_OFF);
Vibrate on notify in silent only:
setVibrateSetting(AudioManager.VIBRATE_TYPE_NOTIFICATION, AudioManager.VIBRATE_SETTING_ONLY_SILENT);
Change ringer mode:
AudioManager.setRingerMode(RINGER_MODE_NORMAL); AudioManager.setRingerMode(RINGER_MODE_SILENT); AudioManager.setRingerMode(RINGER_MODE_VIBRATE);
Vibrate settings are independent of ringer settings. Confusion ensues.