android.permission.WRITE_SECURE_SETTINGS 错误
您好,我的问题是,当我尝试更改天气或未启用 GPS 设置时,出现以下错误 10-20 05:44:31.890: E/AndroidRuntime(889): java.lang.SecurityException: Permission denial :写入安全设置需要 android.permission.WRITE_SECURE_SETTINGS
而在我的清单文件中,我确实拥有清单文件中的错误中列出的权限。
清单:
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
任何帮助将不胜感激
Hello my problem is that when I try to change weather or not the GPS setting is enabled I get the following error 10-20 05:44:31.890: E/AndroidRuntime(889): java.lang.SecurityException: Permission denial: writing to secure settings requires android.permission.WRITE_SECURE_SETTINGS
while in my manifest file I do have the permission listed in the error inside my manifest file.
Manifest:
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"/>
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
WRITE_SECURE_SETTINGS
是一个signatureOrSystem
权限,意味着普通的SDK应用程序无法持有它。只有与固件相关的应用程序才能持有此权限。WRITE_SECURE_SETTINGS
is asignatureOrSystem
permission, meaning that ordinary SDK applications cannot hold it. Only apps that are related to the firmware can hold this permission.阅读此特定问题的所有答案,解决此问题的一种方法是使用此代码来启用gps,但它无法工作正如 CommonsWare 指出的,应用程序必须是系统应用程序才能使此代码正常工作。因此可以使用 TitaniumBackup 将应用程序转换为系统应用程序。现在这对我来说工作得很好。
*索尼用户将看到另一条消息“将在使用 GPS 时收集匿名数据” - 为了克服这个问题,“冻结”“学习客户端”应用程序,一切都会好起来的。
Reading all answers for this particular issue, one way around for this is to use this code to enable the gps but it wont work, as CommonsWare pointed, the application has to be system app for getting this code to work..so one can convert the application into system app by using TitaniumBackup. THis is working perfectly fine for me now.
*Sony users will see another message "Will collect anonymous data while using gps" - to overcome this, 'Freeze' the "LEarning Client" app and everything will be fine.