I'm trying to call a method on a specified time by the user. For example, "at 4:00pm- send a message to Bob".
I understand how to get the calendar.HOUR()
, calendar.MINUTE()
, etc; however, I'm unsure where to place this code. I want to make sure the method calls on the right time, but I also don't want to have to update the calendar time
every second (for fear of too much battery usage of RAM).
I'm currently using this, which is in the onCreate
method.
if (calendarHour == startHour && calendarMinute == startMinute)
{
//do stuff
}
Is there a standard on how to check what time is it without spamming? What code would I use and where do I place it?