Android Alarmmanager: How To Find Out The Time Remaining To Trigger The Pendingintent
I am developing an alarm clock app. Below I have a function to set the alarm. But I want to know how to find the remaining time AlarmManager to trigger the PendingIntent. For examp
Solution 1:
You can calculate the difference between your alarm time (totalTime
) and the current time like this:
long timeDiffInMillis = totalTime - System.currentTimeMillis();
This will give you the time remaining before your alarm will trigger (in milliseconds).
Post a Comment for "Android Alarmmanager: How To Find Out The Time Remaining To Trigger The Pendingintent"