Files
react-native-notifications/docs/general-api.md
Bilal Abdeen 69a78bb941 referencing registerRemoteNotificationsRegistered (#466)
Under the title "registerRemoteNotifications", I made the following change. 
replaced: RemoteNotificationsRegistered
with: registerRemoteNotificationsRegistered
2020-01-29 13:55:11 +02:00

1.5 KiB
Executable File

id, title, sidebar_label
id title sidebar_label
general-api General Commands General

registerRemoteNotifications()

Requests remote notification permissions, prompting the user's dialog box on iOS and request a token on Android. If the user accept the remote notifications permissions, registerRemoteNotificationsRegistered event will get called with the device token.

Notifications.registerRemoteNotifications();

getInitialNotification()

This method returns a promise. If the app was launched by a push notification, this promise resolves to an object of type Notification. Otherwise, it resolves to undefined.

const notification: Notification = await Notifications.getInitialNotification();

postLocalNotification(notification, id?)

Posts local notification to the device notification center.

Notifications.postLocalNotification({
  body: 'Local notificiation!',
  title: 'Local Notification Title',
  sound: 'chime.aiff',
  category: 'SOME_CATEGORY',
  link: 'localNotificationLink',
  fireDate: new Date()
}, id);

cancelLocalNotification(id)

Relevant for notifications sent with fireDate.

Notifications.cancelLocalNotification(id);

isRegisteredForRemoteNotifications()

Check if the app has permissions to send remote notifications.

const hasPermissions: boolean = await Notifications.isRegisteredForRemoteNotifications();

removeAllDeliveredNotifications()

Remove all delivered notifications from Notification Center

Notifications.removeAllDeliveredNotifications();