froyo 中的振动设置
我在 froyo 中读到,如果您使用 setVibrateSettings()
更改振动设置,它不会与 SO 振动设置同步。然后我发现人们将此解决方法与此链接中的某些功能一起使用:
但是,该源代码有两个调用:
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);
这是与我尝试在代码中更改振动设置的唯一区别。但是 Settings.System.VIBRATE_IN_SILENT
似乎在 2.2 中被删除,所以当我更改振动设置“正常,关闭,仅在静音”时,然后我转到 SO 音频设置,并且 vib 值不同,并且如果我返回我的应用程序,vib 设置也与我之前选择的不同。有什么想法吗?
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:
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试以下链接:
http://www .kiwidoc.com/java/l/p/android/android/8/p/android.provider/c/Settings.System
根据我的尝试,该设置仍然存在,但没有像以前那样公开。仍然可以使用 Settings.System.putInt(...) 进行设置,只需指定名称“vibrate_in_silent”。
我想有一天这将不再起作用,所以我建议以任何可能的方式保护您的代码(首先通过调用 getInt 检查设置是否存在,添加 try-catch...)
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...)