Мне нужно установить будильник, чтобы пользователь напоминал ему о необходимости принимать лекарства.тревога срабатывает иногда и нет.
После перезагрузки приложения, при загрузке приемника, я снова сбрасываю сигнал тревоги.Даже если он не срабатывает.
AlarmManager manager = AlarmManagerProvider.getAlarmManager(context);
int uniqueId = CommonUtils.generateRandomID();
Intent intent = new Intent(context, PrescriptionAlarmActivity.class);
Cursor cursor = null;
if (reminderTask != null) {
cursor = context.getContentResolver().query(reminderTask, null, null, null, null);
}
String description = "";
try {
if (cursor != null && cursor.moveToFirst()) {
description = AlarmReminderContract.getColumnString(cursor, AlarmReminderContract.AlarmReminderEntry.KEY_TITLE);
}
} finally {
if (cursor != null) {
cursor.close();
}
}
intent.putExtra("medicineName", description);
PendingIntent operation = PendingIntent.getActivity(context, uniqueId, intent, PendingIntent.FLAG_UPDATE_CURRENT);
//manager.setRepeating(AlarmManager.RTC_WAKEUP, alarmTime, RepeatTime, operation);
try {
manager.setInexactRepeating(AlarmManager.RTC_WAKEUP, alarmTime, RepeatTime,
operation);
} catch (Exception e) {
e.printStackTrace();
}
в течение 1-го дня, срабатывает сигнал тревоги, и на следующий день он не работает.