question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Channel name updated when sending local notification

See original GitHub issue

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',
    });

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:10

github_iconTop GitHub Comments

2reactions
Dallas62commented, Sep 26, 2020

Just released 😉

1reaction
piotrponikowskicommented, Sep 23, 2020

I tested with dev branch and it works correctly for me - channel name is not overwritten to default name anymore.

Thank you for help!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and Manage Notification Channels - Android Developers
Create a notification channel · Construct a NotificationChannel object with a unique channel ID, a user-visible name, and an importance level.
Read more >
Notification channels: Control where to send alerts
To set up a new notification channel: On the Notification channels, click New notification channel. Select the type of channel and complete other...
Read more >
Creating Local Notifications in Flutter - Kodeco
Learn how to create cross-platform local notifications in Flutter using ... to define a channel ID and name of the notification for Android....
Read more >
User Notifications | Apple Developer Documentation
Notifications can display an alert, play a sound, or badge the app's icon. You can generate notifications locally from your app or remotely...
Read more >
Flutter Local Notification - Nitish Kumar Singh - Medium
async { ; var androidPlatformChannelSpecifics = ; new AndroidNotificationDetails( ; 'your channel id', ; 'your channel name', ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found