You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Use UserNotifications to create local notifications
a15e038 adds support for enumerating/dismissing delivered notifications
by ID, but UserNotifications notifications and UILocalNotification
notifications have a different set of IDs (a notification created using
UILocalNotification will have an ID that does not match the
notification's ID in the UserNotifications world and hence cannot be
used to dismiss that notification). This commit creates the
notifications using UserNotifications if the user is on iOS 10.
Copy file name to clipboardExpand all lines: README.md
+21-8Lines changed: 21 additions & 8 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -326,7 +326,6 @@ Example:
326
326
let localNotification =NotificationsIOS.localNotification({
327
327
alertBody:"Local notificiation!",
328
328
alertTitle:"Local Notification Title",
329
-
alertAction:"Click here to open",
330
329
soundName:"chime.aiff",
331
330
category:"SOME_CATEGORY",
332
331
userInfo: { }
@@ -338,7 +337,7 @@ Notification object contains:
338
337
-**`fireDate`**-The date and time when the system should deliver the notification (optinal -default is immidiate dispatch).
339
338
- `alertBody`-The message displayed in the notification alert.
340
339
- `alertTitle`-The title of the notification, displayed in the notifications center.
341
-
- `alertAction`-The"action" displayed beneath an actionable notification.
340
+
- `alertAction`-The"action" displayed beneath an actionable notification on the lockscreen (e.g. "Slide to **open**").Note that Apple no longer shows this in iOS 10.
342
341
- `soundName`-The sound played when the notification is fired (optional).
343
342
- `category`-The category of this notification, required for [interactive notifications](#interactive--actionable-notifications-ios-only) (optional).
Upon notification opening (tapping by the device user), all data fields will be delivered as-is).
359
358
360
-
### CancelLocalNotification
361
-
The `NotificationsIOS.localNotification()` and `NotificationsAndroid.localNotification()` methods return unique `notificationId` values, which can be used in order to cancel specific local notifications. You can cancel local notification by calling `NotificationsIOS.cancelLocalNotification(notificationId)` or `NotificationsAndroid.cancelLocalNotification(notificationId)`.
359
+
### CancelScheduledLocalNotifications
360
+
361
+
The `NotificationsIOS.localNotification()` and `NotificationsAndroid.localNotification()` methods return unique `notificationId` values, which can be used in order to cancel specific local notifications that were scheduled for delivery on `fireDate` and have not yet been delivered. You can cancel local notification by calling `NotificationsIOS.cancelLocalNotification(notificationId)` or `NotificationsAndroid.cancelLocalNotification(notificationId)`.
362
362
363
363
Example (iOS):
364
364
365
365
```javascript
366
366
let someLocalNotification =NotificationsIOS.localNotification({
367
367
alertBody:"Local notificiation!",
368
368
alertTitle:"Local Notification Title",
369
-
alertAction:"Click here to open",
370
369
soundName:"chime.aiff",
371
370
category:"SOME_CATEGORY",
372
371
userInfo: { }
@@ -375,12 +374,26 @@ let someLocalNotification = NotificationsIOS.localNotification({
To dismiss notifications from the notification center that have already been shown to the user, call `NotificationsIOS.removeDeliveredNotifications([notificationId])`:
386
+
387
+
```javascript
388
+
let someLocalNotification =NotificationsIOS.localNotification({...});
0 commit comments