有没有什么办法来访问编程设备设置?
例如:设置>开发人员选项> USB调试>真/假
在此先感谢。
编辑:USB调试仅仅是一个例子。我可以访问装置,它存在于每一个设置的设置。
解决方案Settings.Secure.putInt(getActivity()。getContentResolver(),Settings.Secure.ADB_ENABLED, 1);
不过,你需要root访问权限来做到这一点。只有系统的应用程序权限更改安全设置
编辑: 试试这个来显示所有ANRS
Settings.Secure.putInt(ContentResolver的,Settings.Secure.ANR_SHOW_BACKGROUND,0)
和不保留活动
ActivityManagerNative.getDefault()。setAlwaysFinish(真)
但ActivityManagerNative隐藏在标准的API集。你需要做的要么反射或使用该method得到的android.jar。 再次,我想这需要root访问权限
Is there any way to access device settings programmatically?
For Example: Settings > Developer Options > USB debugging > True/False
Thanks in advance.
Edit: USB debugging is just an example. Can I access every settings which is exist in Settings in device.
解决方案Settings.Secure.putInt(getActivity().getContentResolver(),Settings.Secure.ADB_ENABLED, 1);
But you need root access to do this. Only system apps have permission to change secure settings
Edit: Try this to Show all ANRs
Settings.Secure.putInt(ContentResolver,Settings.Secure.ANR_SHOW_BACKGROUND,0);
and for Don't keep activities
ActivityManagerNative.getDefault().setAlwaysFinish(true)
but ActivityManagerNative is hidden in standard api set. you will need to do either reflection or use this method to get android.jar. Again I guess this needs root access