1

In my application, I would like to know if there is a callback method when "Use network-provided time" is enabled in the device.

I could check whether it is enabled or not by the following:

Settings.System.getInt(this.getContentResolver(), Settings.System.AUTO_TIME, 0);

But I dont have idea about a callback method when it is enabled. And I couldn't find it in google.

enter image description here

Dileep Perla
  • 1,865
  • 7
  • 33
  • 54
  • Does [this post](http://stackoverflow.com/a/17175444/905349) help? – Tadej Sep 24 '14 at 10:53
  • 1
    I have tried that already, but it gets triggered even if the user manually changes the time, when "Use network-provided time" is enabled and in all possible cases - when network time is different from device time or time is changed manually. – Dileep Perla Sep 24 '14 at 11:25

1 Answers1

0

In your oncreate,

contentResolver.registerContentObserver(Settings.Global.getUriFor(AUTO_TIME),true,autoTimeObserver)

Then clean up,

contentResolver.unregisterContentObserver(autoTimeObserver)
Kit Mak
  • 231
  • 2
  • 4