Pushwoosh / pushwoosh-react-native-plugin

Other
57 stars 43 forks source link

[Bug]: Push notifications not working on latest version of RN on Android #153

Closed AlbinNewSeed closed 8 months ago

AlbinNewSeed commented 9 months ago

Documentation

Description

version: 6.1.24

App registers push notification correctly without errors according to the library on Android, and an FCM token is received. However, when I go to test devices on the website and try to add the token manually to register my test device, it gives me error and says that the token isn't registered to any device.

Bug severity

High

Steps to Reproduce

  1. Create project with latest RN version "react-native": "0.72.6",
  2. Register and init for push notifications with Pushwoosh
  3. Copy the FCM Token
  4. Attempt to register test device in Pushwoosh website manually using FCM Token
  5. Send push notification to Test devices

Let me know if anyone succeeds in receiving a push notification on Android 14 buildToolsVersion = "33.0.1" minSdkVersion = 24 compileSdkVersion = 33 targetSdkVersion = 33

Your Pushwoosh React Native Plugin version

Other — specify it in the description

Last worked Pushwoosh React Native Plugin version (if any)

No response

Affected platforms

Affected OS versions and/or devices

Android 14 - Pixel 8 Pro

Workaround

No response

Relevant log output

No response

shahjahanpak commented 9 months ago

I am not getting push notifications on android either. Sometimes killing the app would trigger 'em but can't say for sure, it is intermittent.

"react-native": "0.72.6" "pushwoosh-react-native-plugin": "6.1.24"

buildToolsVersion = "33.0.0" minSdkVersion = 24 compileSdkVersion = 33 targetSdkVersion = 33 kotlinVersion = "1.6.10" ndkVersion = "23.1.7779620" playServicesLocationVersion = "21.0.1"

rodrigo1995vav commented 9 months ago

Same problem here trying to make it work on android. In general, notifications never arrive, but sometimes out of nowhere they do. I've been trying to solve this for the past 5 days, so believe me when I say I tried everything. It just doesn't work

pushwoosh-react-native-plugin: "6.1.24" react-native": "0.72.6"

buildToolsVersion = "33.0.0" minSdkVersion = 24 compileSdkVersion = 33 targetSdkVersion = 33

shahjahanpak commented 9 months ago

As a quick workaround I downgraded pushwoosh-react-native-plugin to 6.1.16. Now I can get push notifications on android.

enginseer-dev commented 9 months ago

Confirmed, will be fixed with the next release.

wfhm commented 8 months ago

Sorry for the late reply, the issue was fixed with the 6.1.26 release.

AlbinNewSeed commented 8 months ago

Sorry for the late reply, the issue was fixed with the 6.1.26 release.

Still not working for me though. What was fixed? Can't see any fix in the commit history related to Android.

enginseer-dev commented 8 months ago

Hi @AlbinNewSeed,

In the release notes of the React Native plugin, this information is really missing, but I assume that @wfhm has mentioned changes https://github.com/Pushwoosh/pushwoosh-android-sdk/releases/tag/6.7.0 from the Android SDK which was included to the React Native since 6.1.25.

Do I understand correctly that you updated the plugin to the latest version and built the application from scratch?

Did you clean and build the app using

./gradlew clean
./gradlew assembleDebug

Or even the following (please be careful)

// delete the node_modules folder
rm -rf node_modules
// remove build artifacts
rm -rf android/build
// clear cache
watchman watch-del-all
npm cache clean --force
rm -rf $TMPDIR/react-*

?

AlbinNewSeed commented 8 months ago

Hi @AlbinNewSeed,

In the release notes of the React Native plugin, this information is really missing, but I assume that @wfhm has mentioned changes https://github.com/Pushwoosh/pushwoosh-android-sdk/releases/tag/6.7.0 from the Android SDK which was included to the React Native since 6.1.25.

Do I understand correctly that you updated the plugin to the latest version and built the application from scratch?

Did you clean and build the app using

./gradlew clean
./gradlew assembleDebug

Or even the following (please be careful)

// delete the node_modules folder
rm -rf node_modules
// remove build artifacts
rm -rf android/build
// clear cache
watchman watch-del-all
npm cache clean --force
rm -rf $TMPDIR/react-*

?

Will try it, thanks 👍

enginseer-dev commented 8 months ago

Sure, will be waiting to the results! Just let us know if the issue remains after the upgrade.

AlbinNewSeed commented 8 months ago

Sure, will be waiting to the results! Just let us know if the issue remains after the upgrade.

Hi again.

I tried your instructions and it still is not working unfortunately...

Still receiving a token but the token isn't working.

enginseer-dev commented 8 months ago

@AlbinNewSeed I've integrated the Pushwoosh React Native plugin (6.1.26) in a sample project to replicate your issue. In my tests, push notifications were successfully received.

To help troubleshoot your setup, you can refer to this sample project: https://github.com/enginseer-dev/react_native_basic_sample/tree/main It might give you insights into any differences in integration.

Remember, React Native requires specific setup for foreground push notifications. You can find the necessary steps here: https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin

For accurate testing, try sending push notifications when the app is in the background or closed.

AlbinNewSeed commented 8 months ago

@AlbinNewSeed I've integrated the Pushwoosh React Native plugin (6.1.26) in a sample project to replicate your issue. In my tests, push notifications were successfully received.

To help troubleshoot your setup, you can refer to this sample project: https://github.com/enginseer-dev/react_native_basic_sample/tree/main It might give you insights into any differences in integration.

Remember, React Native requires specific setup for foreground push notifications. You can find the necessary steps here: https://docs.pushwoosh.com/platform-docs/pushwoosh-sdk/cross-platform-frameworks/react-native/integrating-react-native-plugin

For accurate testing, try sending push notifications when the app is in the background or closed.

Ok, I've upgraded the entire project to react 0.73.1 to match the sample project you provided, and upgraded dependencies. I've double checked every possible line of code is exactly as in your sample project Still getting the same result; pushwoosh register returns a token which doesn't work. :(

enginseer-dev commented 8 months ago

@AlbinNewSeed If you add your app code, sender ID and google-services.json to the sample project, does the sample project work in your case?

Also, we need the complete logs from your original app, from installation to expected push notification receipt.

You can send the logs to help@pushwoosh.com. Don’t forget to reference this specific issue in your email for context.

AlbinNewSeed commented 8 months ago

@AlbinNewSeed If you add your app code, sender ID and google-services.json to the sample project, does the sample project work in your case?

Also, we need the complete logs from your original app, from installation to expected push notification receipt.

You can send the logs to help@pushwoosh.com. Don’t forget to reference this specific issue in your email for context.

It's working today in my app without having made any changes since yesterday for some reason. This morning I went and tried a another phone just to be sure my phone isn't bricked for some reason and it worked, and then tried my P8P again and it's working on both. 👍

I went back to previous branch before the project upgrade (0.72.6-0.73.1) and it's not working there, so something must've done it, I have no clue what though.

I tried your sample app and it works as well on both phones.

Thanks so much for the help!

enginseer-dev commented 8 months ago

@AlbinNewSeed I was glad to help!

Have a great New Year!