React-native-push-notification: The need of custom channel_id in android.

Created on 4 Nov 2019  路  10Comments  路  Source: zo0r/react-native-push-notification

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 :)

Most helpful comment

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

All 10 comments

You can fork and commit to your repos :D

@codevoler that is an option sure but then it gives you headaches with merging on every new release.

@kneza23 but i will work around with you for this time :D

@codevoler there are few active pull requests that are trying to solve this same problem, i think there is no need for me to do it also :)

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

Hi,
This change is important, but couldn't simply be solved by a magic entry in the AndroidManifest since a part of the channel_id is dynamic.
In the current state of the Library, I'm not sure this change will solve the real problem of channel management.

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

Hi, the release 4.0.0 of the library should solve this issue, feel free to reopen if something is missing 馃槈

Cool! Thanks!

Also a pending PR will allow directly create channels inside the Application.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

uendar picture uendar  路  3Comments

NiuQiaoling picture NiuQiaoling  路  3Comments

nguyenvanphuc2203 picture nguyenvanphuc2203  路  3Comments

GastonEDiaz picture GastonEDiaz  路  3Comments

nidzovito picture nidzovito  路  3Comments