public override void OnReceive(Context context, Intent intent) { var preferences = context.GetSharedPreferences(Constants.SharedPreferencesKey, FileCreationMode.Private); if (!preferences.GetBoolean(Constants.ServiceIsStartedKey, false)) { return; } var exerciseSchedule = _data.GetExerciseSchedule(); ExerciseServiceManager.SetNextAlarm(context, exerciseSchedule); }
public override void OnReceive(Context context, Intent intent) { var preferences = context.GetSharedPreferences(Constants.SharedPreferencesKey, FileCreationMode.Private); if (!preferences.GetBoolean(Constants.ServiceIsStartedKey, false)) { return; } var exerciseSchedule = _data.GetExerciseSchedule(); var now = DateTime.Now.TimeOfDay; if (now > exerciseSchedule.StartTime.TimeOfDay && now < exerciseSchedule.EndTime.TimeOfDay) { UserNotification.CreateExerciseNotification(_data, context); } var nextAlarmTime = ExerciseServiceManager.SetNextAlarm(context, exerciseSchedule); if (nextAlarmTime.Date > DateTime.Now.Date && PreferenceManager.GetDefaultSharedPreferences(context).GetBoolean(context.Resources.GetString(Resource.String.CheckHistoryReminderKey), true)) { UserNotification.CreateHistoryReminderNotification(context); } }