Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The need of custom channel_id in android. #1232

Closed
kneza23 opened this issue Nov 4, 2019 · 10 comments
Closed

The need of custom channel_id in android. #1232

kneza23 opened this issue Nov 4, 2019 · 10 comments
Assignees

Comments

@kneza23
Copy link

kneza23 commented Nov 4, 2019

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

@kneza23 kneza23 changed the title We need custom channel_id in android. The need of custom channel_id in android. Nov 4, 2019
@mrminhhuy
Copy link

You can fork and commit to your repos :D

@kneza23
Copy link
Author

kneza23 commented Nov 5, 2019

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

@mrminhhuy
Copy link

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

@kneza23
Copy link
Author

kneza23 commented Nov 5, 2019

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

@rocboronat
Copy link

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

@Dallas62
Copy link
Collaborator

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.

@Dallas62
Copy link
Collaborator

Dallas62 commented 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:
#1432 (comment)

@Dallas62
Copy link
Collaborator

Dallas62 commented Jul 8, 2020

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

@Dallas62 Dallas62 closed this as completed Jul 8, 2020
@rocboronat
Copy link

Cool! Thanks!

@Dallas62
Copy link
Collaborator

Dallas62 commented Jul 8, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants