Closed KemikalGeneral closed 3 years ago
I'm having this same issue of onRegister()
not firing on Android, It works perfectly on iOS
@KemikalGeneral, I just resolved this, please ensure you've included your senderID
// ANDROID ONLY: GCM or FCM Sender ID (product_number) (optional - not required for local notifications, but is need to receive remote push notifications) senderID: "YOUR GCM (OR FCM) SENDER ID",
I'm wondering if this package and/or setup still works now that GCM is deprecated in favour of FCM?
@matt-wright86 yeah, it's in my notifications.js ☹️
@KemikalGeneral put this in your AndroidManifest.xml inside application block
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationPublisher" />
<receiver android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationBootEventReceiver">
<intent-filter>
<action android:name="android.intent.action.BOOT_COMPLETED" />
</intent-filter>
</receiver>
<service android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationRegistrationService" />
<service
android:name="com.dieam.reactnativepushnotification.modules.RNPushNotificationListenerService"
android:exported="false">
<intent-filter>
<action android:name="com.google.firebase.MESSAGING_EVENT" />
</intent-filter>
</service>
@KemikalGeneral Hello, have you fixed this issue and make the android permission popped up or have the device token generated? I try everything and nothing about the device token worked. Thanks
Hi @LucienChu
Yes i did, but i had to add some missing bits to the manifest. You can check out my question, and answer, on StackOverflow
https://stackoverflow.com/questions/56022476/why-isnt-a-device-token-being-generated
I must say though, from reading around, it seems like everyone had their own fix for this problem, so my solution may not work. I think the maintainers of this package need to give it a good going over and update the documentation to suit as it's pretty poor in its current state.
Facing same issue for android version 8.0.1 Lg device Stylo 4. Do we have fixed solution. plugin version "react-native-push-notification": "^3.1.3",
This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 30 days if no further activity occurs. Thank you for your contributions.
Hello,
I've been stuck on this for a good few days now, and I just can't find a way to get it to work. I know it's been brought up a few times over the years, with varying degrees of success, and I've tried all of the 'solutions', but with no luck.
NB... I haven't tried it on iOS yet, so this is mostly an Android issue.
I have followed the instructions, and searched the trouble shooting, but I cannot get the device token from
onRegister
.I can get a local notification to fire on load, and
onNotification
is being called upon interaction, but no token.I'm not sure how relevant this is, but I thought I'd have to give permission(?), but even though
requestPermissions
is true, I never get asked. I did a little digging, and innode_modules\react-native-push-notification\index.js
there are two functions requesting permissions.This is getting called automatically and has the correct senderID
This only gets called if I explicitly call
PushNotifications.requestPermissions()
but the senderID is undefinedI've tried lots of different combinations of adding or removing lines from Gradle and the Manifest, but nothing's worked, so I've started again with just the lines from the documentation. Originally, I had the call to
configurePushNotifications()
in my logIn function, but read that it should be called from the highest component before loading the JS, so i moved it toindex.js
, but it didn't make any difference, still no token.I'm literally at my wits end, and could really do with some help please, there's a Ferrero Rocher Easter egg up for grabs for whoever solves it!
Thanks xxx
Testing on Windows Android Device, not emulator react-native-cli: 2.0.1 react-native: 0.59.5 react-native-push-notification": ^3.1.3,
AndroidManifest
app\build.gradle
android\build.gradle
notifications.js