Vibrate settings on Android 2.2

后端 未结 2 902
我在风中等你
我在风中等你 2020-12-28 11:27

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

相关标签:
2条回答
  • 2020-12-28 11:49

    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.

    0 讨论(0)
  • 2020-12-28 12:10

    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.

    0 讨论(0)
提交回复
热议问题