reschedule all notifications at reboot as needed
This commit is contained in:
parent
1d65ad305e
commit
6c783bead1
|
@ -243,13 +243,14 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||
|
||||
public List<Event> getEventsAtReboot() {
|
||||
List<Event> events = new ArrayList<>();
|
||||
final String selection = COL_START_TS + " > ? AND " + COL_REMINDER_MINUTES + " != ?";
|
||||
final String[] selectionArgs = {String.valueOf(DateTime.now().getMillis() / 1000), "-1"};
|
||||
final String selection = COL_REMINDER_MINUTES + " != -1 AND (" + COL_START_TS + " > ? OR " + COL_REPEAT_INTERVAL + " != 0)";
|
||||
final String[] selectionArgs = {String.valueOf(DateTime.now().getMillis() / 1000)};
|
||||
final Cursor cursor = getEventsCursor(selection, selectionArgs);
|
||||
|
||||
if (cursor != null) {
|
||||
events = fillEvents(cursor);
|
||||
}
|
||||
|
||||
return events;
|
||||
}
|
||||
|
||||
|
|
|
@ -16,7 +16,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
|||
public void onReceive(Context context, Intent arg1) {
|
||||
final List<Event> events = DBHelper.newInstance(context, null).getEventsAtReboot();
|
||||
for (Event event : events) {
|
||||
Utils.scheduleNotification(context, event);
|
||||
Utils.scheduleNextEvent(context, event);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue