The android app will notify user only between the time interval user selects.
Settings will have two timepickers to store TIME1
and TIME2
I am planning to store the time in INT format as suggested by following link
link --> Store time in int data type in sql
Following the above approach while comparing with current time:-
USE CASE 1
TIME1 | TIME2 | Currenttime
03:00(180 INT) | 06:00(360 INT) | 05:00(300 INT)
TIME1 <= Currenttime <= TIME2 (USER WILL RECEIVE NOTIFICATION)
USE CASE 2 (time2 < time1)
Should i even allow user to select time 2
TIME1 | TIME2 | Currenttime
22:00(1320 INT) | 01:00(60 INT) | 23:00(1380 INT)
TIME1 < Currenttime > TIME2
1320 < 1380 > 60
22:00 < 23:00 < 01:00
( with respect to realtime when user wants to get notified at midnight)
in this case user should actually get the notification if reverse time is allowed.
considering user wants notification during midnight.
if((Currentime > time2 && Currentime <= 1439)|| (Currentime > 0 && Currentime <= time1)){
// notify here // 1439 == 23:59
}
USE CASE 3 (arises if use case 2 allowed/actually same as 2 bu with more time interval)
consider same case as 2 but time as:-
TIME1 | TIME2
15:00(900 INT) | 10:00(600 INT)
This means USER DOES NOT WANT NOTIFICATION form morning 10:01 to afternoon 14:59
But user wants it for rest of the time like from afternoon 15:00 to next day morning 10:00
I think this is the best way to do , but I want to know is there any better approach ? or easier approach ? plus should user be allowed to set reverse time ? if not then user wont be able to set midnight intervals.
Help is appreciated.