Add isScheduled method to avoid schedule notification on each onPause of DrugListActivity.

This commit is contained in:
jacques 2022-03-23 09:16:47 +01:00
parent 8879c6a2ce
commit 3199a0abdc

View file

@ -148,4 +148,10 @@ public class AlarmReceiver extends BroadcastReceiver {
if (BuildConfig.DEBUG) { Toast.makeText(context, "Alarm scheduled for " + UtilDate.convertDate(calendar.getTimeInMillis()), Toast.LENGTH_SHORT).show(); }
}
public static Boolean isAlarmScheduled(Context context) {
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
return alarmManager.getNextAlarmClock() != null;
}
}