Commit f873a096 authored by Sebastián Katzer's avatar Sebastián Katzer
Browse files

The application context needs to be set as first after reboot

parent 6e82355c
Loading
Loading
Loading
Loading
+3 −2
Changes for src/android/Restore.java: 3 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -40,6 +40,9 @@ public class Restore extends BroadcastReceiver {

    @Override
    public void onReceive(Context context, Intent intent) {
        // The application context needs to be set as first
        LocalNotification.setContext(context);

        // Obtain alarm details form Shared Preferences
        SharedPreferences alarms = LocalNotification.getSharedPreferences();
        Set<String> alarmIds     = alarms.getAll().keySet();
@@ -53,8 +56,6 @@ public class Restore extends BroadcastReceiver {
                JSONArray args  = new JSONArray(alarms.getString(alarmId, ""));
                Options options = new Options(context).parse(args.getJSONObject(0));

                // The context got lost after reboot
                LocalNotification.setContext(context);
                LocalNotification.add(options);

            } catch (JSONException e) {}