Enable "Use network values" programmatically in android

I want to be able to check this parameter programmatically in on create ... after user request forchurs

BJW9x.jpg

Sort of

if (android.systemtime==false) { systemtime=true; } 

Is it possible? any help would be appreciated

+4
source share
1 answer

You are looking for Settings.System.AUTO_TIME settings (which has been ported to Settings.Global.AUTO_TIME in API 17). Prior to API level 17, you could read and change this value, but now this value is read-only for non-system applications.

 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; } 
+5
source

Source: https://habr.com/ru/post/1501421/


All Articles