Android アプリは、ユーザーが選択した時間間隔の間のみユーザーに通知します。
設定には、保存する 2 つのタイムピッカーがTIME1
あり、TIME2
次のリンク
リンクで提案されているように、時刻を INT 形式で保存する予定です --> SQL の int データ型で時刻を保存する
現在の時刻と比較しながら上記のアプローチに従います:-
ユースケース 1
TIME1 | TIME2 | Currenttime
03:00(180 INT) | 06:00(360 INT) | 05:00(300 INT)
TIME1 <= Currenttime <= TIME2 (USER WILL RECEIVE NOTIFICATION)
ユースケース 2 (time2 < time1)
ユーザーが時間を選択できるようにする必要がありますか 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
}
ユース ケース 3 (ユース ケース 2 が許可されている場合に発生します/実際には 2 bu と同じで、時間間隔が長くなります)
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
これが最善の方法だと思いますが、もっと良い方法はありますか?またはより簡単なアプローチ?さらに、ユーザーがリバース時間を設定できるようにする必要がありますか? そうでない場合、ユーザーは真夜中の間隔を設定できません。
助けていただければ幸いです。