开发者

Is there a way to know the time remaining for the alarm to go off or the elapsed time since alarm started from API

Assume I set alarm to off after 8 hours from now using AlarmManager. I exit the App and open it back. Now开发者_StackOverflow社区 I want to know the time remaining for the alarm to go off or the elapsed time since alarm started. Is there a way to know this from Android API. Of course one way is by the calculation of (currentTime - Alarm started time). But if the user changes his device time then it's a problem.

Thanks


Is there a way to know this from Android API.

No, sorry.

Of course one way is by the calculation of (currentTime - Alarm started time). But if the user changes his device time then it's a problem.

The alarm will behave the same as your proposed logic, AFAIK. If you use an RTC or RTC_WAKEUP alarm, it will go off at your stated time, regardless of whether or not the time on the device changed. Conversely, if you use ELAPSED_REALTIME or ELAPSED_REALTIME_WAKEUP, then whether the time on the device changed is irrelevant.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜