How to check “Automatic date and time” is enabled or not?

前端 未结 4 1922
鱼传尺愫
鱼传尺愫 2020-12-13 09:45

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.

<
4条回答
  •  失恋的感觉
    2020-12-13 10:44

    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);
    

提交回复
热议问题