Commit 40461306 by Sebastián Katzer

`onadd` was called each time after a repeating message was triggered

parent 7c642208
......@@ -46,11 +46,14 @@ or to use this exact version:
More informations can be found [here](https://build.phonegap.com/plugins/413).
## Release Notes
#### Version 0.7.2 (not yet released)
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
- [bugfix:] `onadd` was called each time after a repeating message was triggered (Android)
#### Version 0.7.1 (31.01.2014)
- [bugfix:] `ongoing` attribute was ignored.
- [bugfix:] `oncancel` wasnt fired if `autoCancel` was set to true.
- [bugfix:] App throwed an error at restart if a callback was registered.
- [enhancement:] Avoid blocking the main thread (on Android) **(dpogue)**.
#### Version 0.7.0 (22.01.2014)
**Note:** The new way of callback registration will be not compatible with previous versions! See #62
......
......@@ -76,7 +76,7 @@ public class LocalNotification extends CordovaPlugin {
Options options = new Options(context).parse(arguments);
persist(options.getId(), args);
add(options);
add(options, true);
}
});
......@@ -116,8 +116,10 @@ public class LocalNotification extends CordovaPlugin {
*
* @param options
* The options that can be specified per alarm.
* @param doFireEvent
* If the onadd callback shall be called.
*/
public static void add (Options options) {
public static void add (Options options, boolean doFireEvent) {
long triggerTime = options.getDate();
Intent intent = new Intent(context, Receiver.class)
......@@ -127,7 +129,9 @@ public class LocalNotification extends CordovaPlugin {
AlarmManager am = getAlarmManager();
PendingIntent pi = PendingIntent.getBroadcast(context, 0, intent, PendingIntent.FLAG_CANCEL_CURRENT);
if (doFireEvent) {
fireEvent("add", options.getId(), options.getJSON());
}
am.set(AlarmManager.RTC_WAKEUP, triggerTime, pi);
}
......
......@@ -79,7 +79,7 @@ public class Receiver extends BroadcastReceiver {
} else if (isFirstAlarmInFuture()) {
return;
} else {
LocalNotification.add(options.moveDate());
LocalNotification.add(options.moveDate(), false);
}
Builder notification = buildNotification();
......
......@@ -59,7 +59,7 @@ public class Restore extends BroadcastReceiver {
/*
* If the trigger date was in the past, the notification will be displayed immediately.
*/
LocalNotification.add(options);
LocalNotification.add(options, false);
} catch (JSONException e) {}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment