Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/184.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android froyo中的振动设置_Android_Silent_Vibration_Android Audiomanager_Android 2.2 Froyo - Fatal编程技术网

Android froyo中的振动设置

Android froyo中的振动设置,android,silent,vibration,android-audiomanager,android-2.2-froyo,Android,Silent,Vibration,Android Audiomanager,Android 2.2 Froyo,我在froyo中读到,如果您使用setVibrationSettings()更改振动设置,它不会与SO振动设置同步。然后,我找到了人们使用此链接中的一些功能的解决方法: 但是,该源代码有两个调用: 173 boolean vibeInSilent = (Settings.System.getInt( 174 getContentResolver(), 175 Settings.System.VIBRATE_IN_SILENT,

我在froyo中读到,如果您使用
setVibrationSettings()
更改振动设置,它不会与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\u IN_SILENT
似乎在2.2中被删除,所以当我将振动设置更改为“正常,关闭,仅在静默”时,我会转到“音频设置”和“振动值”不同,如果我返回到我的应用程序,振动设置也与我以前选择的不同。有什么想法吗?

请尝试以下链接:

根据我的尝试,该设置仍然存在,但不像以前那样公开。仍然可以使用Settings.System.putInt(…)进行设置,只需指定名称“silent中的振动”

我想有一天这将不再有效,所以我建议以任何可能的方式保护您的代码(首先调用getInt检查设置是否存在,添加try-catch…)