Commit 5e1d9d1e authored by Libin Lu's avatar Libin Lu Committed by GitHub

Merge pull request #1052 from esipavicius/patch-1

Update Readme how to use channels
parents e3112d88 2a6c09e5
......@@ -735,3 +735,39 @@ fetch('https://fcm.googleapis.com/fcm/send', {
})
})
```
## Channels
Right now for Android Orion 8 or API 26 is important to use channels. To make it working first of all add default meta data to `AndroidManifest`:
```
<meta-data android:name="com.google.firebase.messaging.default_notification_channel_id" android:value="@string/default_notification_channel_id"/>
```
Now you should `createNotificationChannel` on init app. Its creates if not exists yet.
```
FCM.createNotificationChannel({
id: 'car_status',
name: 'Car status',
description: 'Notifies when changes car status',
priority: 'max',
});
```
After this all notifications should have `channel` key and value with specified channel name. For example:
```
customNotification = {
id: 'id',
title: `title`,
body: 'body',
sound: 'default',
priority: 'high',
icon: 'ic_launcher',
show_in_foreground: true,
vibrate: 500,
channel: 'car_status',
action: 'android.intent.action.MAIN',
};
```
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment