문제

I read that in froyo if you change vibrate settings with setVibrateSettings() it doesn't sync with SO vibrate settings. Then I found this workaround that people use with some of the functions in this link:

https://android.googlesource.com/platform/packages/apps/Settings/+/froyo-release/src/com/android/settings/SoundSettings.java

However, that source code there are two calls to:

 173        boolean vibeInSilent = (Settings.System.getInt(
 174             getContentResolver(),
 175             Settings.System.VIBRATE_IN_SILENT,
 176             1) == 1);

 227        Settings.System.putInt(getContentResolver(),
 228             Settings.System.VIBRATE_IN_SILENT,
 229             vibeInSilent ? 1 : 0);

That are the only difference with what I try to do in my code to change vibrate setttings. But Settings.System.VIBRATE_IN_SILENT seems to be removed in 2.2, so when I change vibrate settings "normal, off, only in silent", then I go to SO audio settings and vib value is different, and if i go back to my app, vib settings are also different to what i selected before. Any ideas?

도움이 되었습니까?

해결책

Try the following link: http://www.kiwidoc.com/java/l/p/android/android/8/p/android.provider/c/Settings.System

From what I have tried, the setting still exist but not exposed as it used to be. It can still be set using the Settings.System.putInt(...) just specify the name "vibrate_in_silent".

I guess that someday this will no longer work so I recommend protecting your code in any way possible (check if setting exist by calling getInt first, add try-catch...)

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top