general-api.md 900 Bytes
Newer Older
yogevbd's avatar
yogevbd committed
1 2
---
id: general-api
yogevbd's avatar
yogevbd committed
3 4
title: General Commands
sidebar_label: General
yogevbd's avatar
yogevbd committed
5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
---

## getInitialNotification
Return the notification that caused the app to launch from dead state.

```js
const notification: Notification = await getInitialNotification();
```

## postLocalNotification(notification, id?)
Posts local notification to the device notification center.

```js
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`.

```js
Notifications.cancelLocalNotification(id);
```

## isRegisteredForRemoteNotifications()
Check if the app has permissions to send remote notifications.

```js
const hasPermissions: boolean = await getInitialNotification();
```