I have created custom channel:
PushNotification.createChannel(
{
channelId: 'myid',
channelName: 'Channel Name',
channelDescription: 'Channel Description',
},
created => console.log(create)
);
and then somewhere in my code I created new local notification:
PushNotification.localNotification({
title: 'Title',
message: 'Message',
channelId: 'myid',
});
After this my channel name has been updated back to default value: 'rn-push-notification-channel'
Looks like this is caused by this check:
https://github.com/zo0r/react-native-push-notification/blob/master/android/src/main/java/com/dieam/reactnativepushnotification/modules/RNPushNotificationHelper.java#L946
Is it intentional behavior?
Based on source code I was able to find workaround by providing channelName and channelDescription when sending notification, however these attributes are not documented.
PushNotification.localNotification({
title: 'Title',
message: 'Message',
channelId: 'myid',
channelName: 'Channel Name',
channelDescription: 'Channel Description',
});
Hi @piotrponikowski
This is not the expected behaviour, I will look into it.
Regards,
I have same issue
Happening to me, and it triggers 2 notifications with the RNPushNotification.presentLocalNotification
Hi,
I didn't made update on this issue, but I recommend you to keep creating channels by yourself (like you mentioned):
PushNotification.createChannel(
{
channelId: 'myid',
channelName: 'Channel Name',
channelDescription: 'Channel Description',
},
created => console.log(create)
);
In order to simplify the library and also avoid some complex edges cases, the following behaviour will be removed:
This means the creation of the channel must be made before you trigger a notification. And this will solve this issue.
You can test changes on dev branch.
Please refer to the CHANGELOG for update instructions:
https://github.com/zo0r/react-native-push-notification/blob/dev/CHANGELOG.md#unreleased
To install this version:
npm install zo0r/react-native-push-notification#dev
OR
yarn add zo0r/react-native-push-notification#dev
Make sure your build cache is cleaned.
I tested with dev branch and it works correctly for me - channel name is not overwritten to default name anymore.
Thank you for help!
Thanks for your feedback !
It works great for me as well- do you know when you'll be releasing ths update?
I will do it at this Friday, don't have enough time this week in case of issues.
Just released 馃槈
Most helpful comment
Just released 馃槈