Closed Pietro-Putelli closed 1 year ago
In your top build.gradle instead of
classpath 'com.google.gms:google-services:4.0.0'
Try this:
classpath ("com.google.gms:google-services:4.3.15")
It's what the docs in firebase say to do, and it doesnt cause the app to crash
Yep I also had this issue and fixed it as above. There's also a PR open to update the docs: #953.
This issue can be closed.
I followed all the steps at https://wix.github.io/react-native-notifications/docs/installation-android/ but I can't get registerRemoteNotificationsRegistered()
to return a token while running on Android. I'm on react-native 0.71.7. The registration event never occurs.
Notifications.registerRemoteNotifications()
Notifications.events().registerRemoteNotificationsRegistered(event => {
// TODO: Send the token to my server so it could send back push notifications...
console.log('Device Token Received', event.deviceToken)
})
Notifications.events().registerRemoteNotificationsRegistrationFailed(event => {
console.error(event)
})
I'm suspecting that Notifications.registerRemoteNotifications()
is busted. How to debug it?
Yep I also had this issue and fixed it as above. There's also a PR open to update the docs: #953.
This issue can be closed.
@tamlyn As seen in my post, I'm able to build fine, but am not getting back a token on Android. You wouldn't happen to have an example of your working Android app kicking around anywhere on GitHub that I could inspect?
@jkoutavas, instead of adding this lines to ./android/app/build.gradle:
dependencies {
...
implementation project(':react-native-notifications')
implementation 'com.google.firebase:firebase-core:16.0.0'
}
as said in docs (https://wix.github.io/react-native-notifications/docs/installation-android), add this:
dependencies {
...
implementation project(':react-native-notifications')
implementation platform('com.google.firebase:firebase-bom:32.0.0')
implementation 'com.google.firebase:firebase-analytics-ktx'
}
Any one else still having this issue? I've made both gradle updates recommended here, and I'm still not receiving the device token.
My usage works perfectly on iOS, so I'm thinking there's one final piece of missing configuration for Android.
@jkoutavas were you able to get it working?
I don't think the issues are related, the gradle problems and not receiving the tokens. I didnt have my gradle set up properly but still received tokens. Just had other issues such as the one at the beginning of this post.
Check again, for completeness. Make sure you completed these correctly:
Also, make sure your FCM is set up sorrectly
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
What solved the problem for me was calling registerRemoteNotificationsRegistered
before calling registerRemoteNotifications
, unlike how the docs suggest.
Using react-native 0.72.3 with the workaround from https://github.com/wix/react-native-notifications/issues/975#issuecomment-1623856736 .
android/build.gradle
contains classpath("com.google.gms:google-services:4.3.15")
android/app/build.gradle
contains:
implementation project(':react-native-notifications')
implementation platform('com.google.firebase:firebase-bom:32.2.0')
implementation "com.google.firebase:firebase-messaging"
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.
The issue has been closed for inactivity.
I have installed the library following all the steps in the documentaiton, created the app on firebase using the
SHA-1
from the project (generating using gradle), downloaded thegoogle-services.json
file and add it under the folder app.Here's the code:
But the
registerRemoteNotificationsRegistered
is not triggered, neitherregisterRemoteNotificationsRegistrationFailed
.The only step I'm missing from the guide is the four (https://wix.github.io/react-native-notifications/docs/installation-android) because
apply plugin: 'com.google.gms.google-services'
cause the build to fail.Here is the version:
react-native: 0.71.4 => 0.71.4