我希望能够在提示用户之后以编程方式检查此选项

就像是
if (android.systemtime==false)
{
systemtime=true;
}
Run Code Online (Sandbox Code Playgroud)
这可能吗?任何帮助,将不胜感激
您正在寻找Settings.System.AUTO_TIME设置(已移至Settings.Global.AUTO_TIMEAPI级别17).在引入API级别17之前,您可以读取并更改该值,但现在此值对于非系统应用程序是只读的.
private boolean isAutoTimeEnabled() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
// For JB+
return Settings.Global.getInt(getContentResolver(), Settings.Global.AUTO_TIME, 0) > 0;
}
// For older Android versions
return Settings.System.getInt(getContentResolver(), Settings.System.AUTO_TIME, 0) > 0;
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1171 次 |
| 最近记录: |