I need to check whether "Automatic date and time" in the android device is enabled or not. If it is not enabled I need to display the popup that it is not enabled.
Is it possible to achieve. If possible, how to check enabled or not ?
Turn on automatic date and time. Open Settings and then tap General management. Tap Date and time. Tap the switch next to Automatic date and time to turn it back on. Your device will now automatically adjust the time.
Turn on Android's automatic date/time setting. Do this through Settings > System > Date & time. Select the button next to Set time automatically to trigger it. If this is already turned on, turn it off, restart your phone, and then turn it back on.
Link for API 17 and above
android.provider.Settings.Global.getInt(getContentResolver(), android.provider.Settings.Global.AUTO_TIME, 0);
Link for API 16 and below
android.provider.Settings.System.getInt(getContentResolver(), android.provider.Settings.System.AUTO_TIME, 0);
public static boolean isTimeAutomatic(Context c) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) { return Settings.Global.getInt(c.getContentResolver(), Settings.Global.AUTO_TIME, 0) == 1; } else { return android.provider.Settings.System.getInt(c.getContentResolver(), android.provider.Settings.System.AUTO_TIME, 0) == 1; } }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With