0

Hello i am relatively new to android so sorry for any mis-interpretations/confusions.

I am working on an application which triggers alarm on the selected time, it working fine, but there is a thing which makes me confuse.

When user selects alarm time, alarm is set for that time but if user changes the time of their android mobile phone, the alarm will be triggered on the time ie- (SystemClock.getTimeInMillis() + selectedTimeInMillis).

How to avoid this situation, i want to trigger the alarm on the exact selected time even if user changes the time of the mobile.

Any help is appreciated.

Muhammad Husnain Tahir
  • 1,009
  • 1
  • 15
  • 28

1 Answers1

0

You could add a request to an internet time server like this:

How to get current time from internet in android

So it will always use the real time and not the system time. I don't think there is another way because you never know if the user changed the system time.

Community
  • 1
  • 1