general-events.md 1.09 KB
Newer Older
yogevbd's avatar
yogevbd committed
1 2
---
id: general-events
yogevbd's avatar
yogevbd committed
3 4
title: General
sidebar_label: General
yogevbd's avatar
yogevbd committed
5 6
---

yogevbd's avatar
yogevbd committed
7 8
## registerRemoteNotificationsRegistered
registerRemoteNotificationsRegistered
yogevbd's avatar
yogevbd committed
9 10

```js
yogevbd's avatar
yogevbd committed
11 12 13
Notifications.events().registerRemoteNotificationsRegistered((event: Registered) => {
  console.log(event.deviceToken);
});
yogevbd's avatar
yogevbd committed
14 15
```

yogevbd's avatar
yogevbd committed
16 17
## registerNotificationReceived
registerNotificationReceived
yogevbd's avatar
yogevbd committed
18 19

```js
yogevbd's avatar
yogevbd committed
20 21 22 23 24 25
Notifications.events().registerNotificationReceived((notification: Notification, completion: (response: NotificationCompletion) => void) => {
  console.log(JSON.stringify(notification.data));

  // Calling completion on iOS with `alert: true` will present the native iOS inApp notification.
  completion({alert: true, sound: true, badge: false});
});
yogevbd's avatar
yogevbd committed
26 27
```

yogevbd's avatar
yogevbd committed
28 29
## registerRemoteNotificationOpened
registerRemoteNotificationOpened
yogevbd's avatar
yogevbd committed
30 31

```js
yogevbd's avatar
yogevbd committed
32 33 34
Notifications.events().registerRemoteNotificationOpened((notification: Notification) => {
  console.log(JSON.stringify(notification.data));
});
yogevbd's avatar
yogevbd committed
35 36
```

yogevbd's avatar
yogevbd committed
37 38
## registerRemoteNotificationsRegistrationFailed
registerRemoteNotificationsRegistrationFailed
yogevbd's avatar
yogevbd committed
39 40

```js
yogevbd's avatar
yogevbd committed
41 42 43 44
Notifications.events().registerRemoteNotificationsRegistrationFailed(() => {
  
});
```