I'm working on an app that performs a task based on a schedule. Briefly, the user will be able to set up some available times - say, Monday 8am-2pm, Tuesday through Friday 9am-5pm, and Saturday 8am-8pm. Then, when the magic button is pressed, the app should find the appropriate task and do it based on the current time. In other words, based on the samples above, if I press the button at 11am on Monday, it should do whatever is in the "Monday 8am-2pm" slot. If I press the button at, say, 6pm on Monday, then the app should do a default action since no event has been assigned at that time.
I think I can handle the coding; what I can't come up with is a reasonable algorithm for having the app determine which action to perform. Any tips, suggestions or thoughts on the logic here will be appreciated.
I think I can handle the coding; what I can't come up with is a reasonable algorithm for having the app determine which action to perform. Any tips, suggestions or thoughts on the logic here will be appreciated.