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

前端 未结 4 1902
鱼传尺愫
鱼传尺愫 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:39

    I would just like to point out that it is possible to cheat (I just did it on a Samsung Galaxy S4, Android 5.0.1):

    • Disable auto time
    • Disconnect from the internets (airplane mode, no wifi etc...)
    • reboot phone (otherwise the real time is retrieved)
    • set auto time on

    Done today:

    Unix time: 1129294173

    Date: 14102005024933

    is automatic? 1 (using android.provider.Settings.Global.getInt(getActivity().getContentResolver(), android.provider.Settings.Global.AUTO_TIME, 0))

    And today definitely isn't Oct 14, 2005

提交回复
热议问题