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

React Native Firebase Push notifications for android build are not working for all the devices (In Android, have not tried in iOS yet) #2380

Open
shivapasunuri opened this issue Aug 29, 2023 · 4 comments

Comments

@shivapasunuri
Copy link

shivapasunuri commented Aug 29, 2023

Problem Statement

Hii, I have been using react native for learning and started to work on a project where this push notifications play a big role.
I have started for building for android first,
I have followed some medium docs to take reference how to implement the push notifications and finally implemented, tested on the virtual device in the android studio and they worked.
Now when i build the android apk and installed on different android devices with different android versions starting from android V9 to V13, i faced these following issues of different cases,

  1. At the 1st install, the push notifications did not worked, but after extracting the fcm token of a device from DB(my app flow in node) and manually tested by the fcm tester, they started working.
  2. Some devices are not even getting any push notifications.
  3. Some devices are getting push notifications by default like everything is fine and if I reinstall the app or remove the data of the app, where the case the fcm token refreshed, the push notifications are not appearing again.

So please help me and if there are any repos that has best implementation works for every device or is there something wrong with react native or is there something wrong in my implementation.

Due to theese unsual fail cases i could not decide where it is going wrong, also all the mobile devicesi have tested on have no restrictions in background or foreground.

Thankyou

@brianomchugh
Copy link

You make any progress on this?

@dmk3141618
Copy link

@dmk3141618
Copy link

Found the issue, upgrading from RN 0.69 to 0.72 changed the Android API level from 31 to 33, and 33 requires the POST_NOTIFICATIONS permission.

https://developer.android.com/develop/ui/views/notifications/notification-permission

I've added this on the AndroidManifest.xml

and added kind of this logic for request permission

https://reactnative.dev/docs/permissionsandroid

Then it works.

@putuoka
Copy link

putuoka commented Nov 2, 2023

Found the issue, upgrading from RN 0.69 to 0.72 changed the Android API level from 31 to 33, and 33 requires the POST_NOTIFICATIONS permission.

https://developer.android.com/develop/ui/views/notifications/notification-permission

I've added this on the AndroidManifest.xml

and added kind of this logic for request permission

https://reactnative.dev/docs/permissionsandroid

Then it works.

yes as far as i know android 13++ turn of notification by default, so user need to tun on it manually by providing popup to allow enable notif in our app it should work

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