瀏覽代碼

Merge branch 'master' of github.com:katzer/cordova-plugin-local-notifications

Sebastián Katzer 10 年之前
父節點
當前提交
51fdb295fe
共有 2 個文件被更改,包括 5 次插入3 次删除
  1. 1 2
      README.md
  2. 4 1
      src/android/LocalNotification.java

+ 1 - 2
README.md

@@ -150,8 +150,7 @@ The method takes a hash as an argument to specify the notification's properties
 Scheduling a local notification will override an earlier one with the same ID.
 All properties are optional. If no date object is given, the notification pops-up immediately.
 
-**Note:** On Android the notification id needs to be a string which can be converted to a number.
-If the ID has an invalid format, it will be ignored, but cancelling the notification will fail.
+**Note:** The notification ID must be a string which can be converted to a number (that is, `isNaN()` returns false for). If the ID has an invalid format, it will silently be changed to `0` and will override an earlier one with the same ID.
 
 #### Further information
 - See the [onadd][onadd] event for registering a listener to be notified when a local notification has been scheduled.

+ 4 - 1
src/android/LocalNotification.java

@@ -180,7 +180,10 @@ public class LocalNotification extends CordovaPlugin {
     	for (int i = 0; i < notifications.length(); i++) {
     		JSONObject options = notifications.optJSONObject(i);
 
-            getNotificationMgr().schedule(options, TriggerReceiver.class);
+            Notification notification =
+                    getNotificationMgr().schedule(options, TriggerReceiver.class);
+            
+            fireEvent("schedule", notification);
     	}
     }