mirror of
https://github.com/SimpleMobileTools/Simple-Calendar.git
synced 2025-02-17 04:10:45 +01:00
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() {
|
public List<Event> getEventsAtReboot() {
|
||||||
List<Event> events = new ArrayList<>();
|
List<Event> events = new ArrayList<>();
|
||||||
final String selection = COL_START_TS + " > ? AND " + COL_REMINDER_MINUTES + " != ?";
|
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), "-1"};
|
final String[] selectionArgs = {String.valueOf(DateTime.now().getMillis() / 1000)};
|
||||||
final Cursor cursor = getEventsCursor(selection, selectionArgs);
|
final Cursor cursor = getEventsCursor(selection, selectionArgs);
|
||||||
|
|
||||||
if (cursor != null) {
|
if (cursor != null) {
|
||||||
events = fillEvents(cursor);
|
events = fillEvents(cursor);
|
||||||
}
|
}
|
||||||
|
|
||||||
return events;
|
return events;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@ public class BootCompletedReceiver extends BroadcastReceiver {
|
|||||||
public void onReceive(Context context, Intent arg1) {
|
public void onReceive(Context context, Intent arg1) {
|
||||||
final List<Event> events = DBHelper.newInstance(context, null).getEventsAtReboot();
|
final List<Event> events = DBHelper.newInstance(context, null).getEventsAtReboot();
|
||||||
for (Event event : events) {
|
for (Event event : events) {
|
||||||
Utils.scheduleNotification(context, event);
|
Utils.scheduleNextEvent(context, event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user