I have currently created a notification which displays no problem when the switch is checked, however I want to create an if statement to set a current time of when the notification will be displayed. I have tried the below however the notification doesn't display at the 3:30pm when tested, am I missing anything or how can I do this?
public void onCheckedChanged(CompoundButton buttonView, boolean notificationSwitchisChecked) {
if(notificationSwitchisChecked){
Calendar.getInstance();
if (Calendar.HOUR_OF_DAY == 15 && Calendar.MINUTE == 30 && Calendar.SECOND == 0){
sendNotification(); // this method works fine and displays the notification no problem when
// checked, however need it displayed at specific time of day
}
}
Aucun commentaire:
Enregistrer un commentaire