From 1f4161bff6763b3ad2598b99d84d2aaad46c477e Mon Sep 17 00:00:00 2001 From: Mark Date: Sun, 17 Nov 2019 14:49:04 +1100 Subject: [PATCH] createChannel suggestion for multiple sounds --- README.md | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/README.md b/README.md index a79594c54..6bb40ba59 100644 --- a/README.md +++ b/README.md @@ -1307,6 +1307,29 @@ Example FCM v1 API notification message payload for invoking the above example c ``` +If your Android app plays multiple sounds or effects, it's a good idea to create a channel for each likely combination. This is because once a channel is created you cannot override sounds/effects. +IE, expanding on the createChannel example: +```javascript +let soundList = ["train","woop","clock","radar","sonar"]; +for (let key of soundList) { + let name = "yourchannelprefix_" + key; + channel.id = name; + channel.sound = key; + channel.name = "Your description " + key; + + // Create the channel + window.FirebasePlugin.createChannel(channel, + function(){ + console.log('Notification Channel created: ' + channel.id + " " + JSON.stringify(channel)); + }, + function(error){ + console.log('Create notification channel error: ' + error); + }); +} +``` + +Note, if you just have one sound / effect combination that the user can customise, just use setDefaultChannel when any changes are made. + #### setDefaultChannel Android 8+ only. Overrides the properties for the default channel.