Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- this.notificationListener = firebase
- .notifications()
- .onNotification((notification: Notification) => {
- const channel = new firebase.notifications.Android.Channel(
- 'test-channel',
- 'Test Channel',
- firebase.notifications.Android.Importance.Max
- ).setDescription('My apps test channel');
- if (notification && notification.data) {
- const data = notification.data;
- if (data && data.messageKey) {
- if (
- data.messageKey === '3001' ||
- data.messageKey === '3006'
- ) {
- channel.setSound('alert');
- } else {
- channel.setSound('chime');
- }
- }
- }
- // Create the channel
- firebase.notifications().android.createChannel(channel);
- // Process your notification as required
- notification
- .android.setChannelId('test-channel')
- .android.setSmallIcon(Images.logoSmall);
- firebase.notifications()
- .displayNotification(notification);
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement