Skip to content

Commit

Permalink
Merge pull request #225 from markterrill/patch-1
Browse files Browse the repository at this point in the history
(Doc) createChannel suggestion for multiple sounds
  • Loading branch information
dpa99c authored Apr 10, 2020
2 parents c6b4ecd + e6ace30 commit b6ee144
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1580,6 +1580,30 @@ 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.
Expand Down

0 comments on commit b6ee144

Please sign in to comment.