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.

The need of custom channel_id in android.

See original GitHub issue

This line of code should not be hardcoded. We should set it from the manifest.

private static final String NOTIFICATION_CHANNEL_ID = "rn-push-notification-channel-id";

Along with these:

      <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_name"
                android:value="New orders (in app)"/>
        <meta-data  android:name="com.dieam.reactnativepushnotification.notification_channel_description"
                    android:value="@string/default_notification_channel_desc"/>

Right now you can set name and description of the default channel.

But, if you want to reference that channel - backend/service fcm notification needs to set that channel_id rn-push-notification-channel-id for you to reference to it, which is just bad practice.

There are few Pull requests that are trying to solve this problem @zo0r , it would be good to check and see if they can be merged 😃

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:10

github_iconTop GitHub Comments

2reactions
Dallas62commented, May 27, 2020

A commit has been made on dev. You can install it for testing purpose:

npm install zo0r/react-native-push-notification#dev
OR
yarn add zo0r/react-native-push-notification#dev

It’s working like #1159 README.md has been updated on dev

Also, another pending change allow you more action on channels: https://github.com/zo0r/react-native-push-notification/issues/1432#issuecomment-633441930

1reaction
rocboronatcommented, May 27, 2020

Please @zo0r, keep this issue in mind. It’s very important on Android to make proper use of the notification channels.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Create and Manage Notification Channels - Android Developers
Construct a NotificationChannel object with a unique channel ID, a user-visible name, and an importance level.
Read more >
android - What "channelId" should I pass to the constructor of ...
This one is the ID of the channel. It tells which channel should be used to send that notification. You can assign any...
Read more >
Android Notification Channel As Deep As Possible - ITNEXT
ChannelId is a unique String to identify each NotificationChannel and is used in Notification.Builder (line 7) when constructing the ...
Read more >
Android: Notification Channel Categories
Set android_channel_id on the create notification REST API to the channel id of your category. This can be found at the top of...
Read more >
Exploring Android O: Notification Channels | by Joe Birch
As of Android O, creating a Notification instance now requires a channel ID to be set by the use of the setChannel() method....
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