onRegister is never called (on device)
I've spent countless hours trying to debug this, and although PushNotification.configure({..}) is called, the onRegister callback never fires — I've set requestPermissions to true, and even tried calling it manually; it still never fires. Currently I'm running it on an ASUS Zenfone Android 7.0 device, but just cant seem to get the token
Same here, trying on iPhone7. Local notifications work.
@Amnesthesia To test, I found using PushNotificationIOS.addEventListener('registrationError', console.log) EXTREMELY useful, it showed me the exact reason of why it was failing.
same problem
so any solution? after a days of efforts, im thinking it was a total waste of time to go for this half documented project altogether. This method never gets called, so cant get token - how will I get remote push working?!!
Same here! Android never working onRegister callback, anyone??
same here, samsung A3.
Ok guys, ive solved this. Here is my post, check it out: https://github.com/zo0r/react-native-push-notification/issues/697
Guys, for iOS you should do this: https://stackoverflow.com/questions/27324020/no-valid-aps-environment-entitlement-string-found-for-application-on-app-store
If you already done setup tutorial for this library, you might be forgotten to setup Push Notifications in Capabilities panel in XCode.
If nothing happend, try to catch error using this code (for iOS only):
PushNotificationIOS.addEventListener('registrationError', (e) => { alert(JSON.stringify(e)) });
This fixed it for me -- I had to go into XCode > Project > Capabilities and turn on Push Notifications. Then the onRegister() callback started firing.
@Amnesthesia + 1 Android onRegister is never called. I got iOS working, got the token, and saved to the back-end where I send remote push notifications. But for Android, onRegister is never called with the same code in configure. So, can't get the token. I've spent hours on this too.
I'm also having trouble with Android onRegister. Tried everything in AndroidManifest.xml. Any ideas?!
Ok guys, ive solved this. Here is my post, check it out: #697
it's ok for android, thank you very much!
@dgurns thanks that solved it for me too.. wasted some good hours on that...
I was having the same problem. For android add senderID: "123****" (sender key value) which are numeric value. It solved my problem. (For GCM its project number).
@lequangtuananh I'm facing this same problem on Android, but I'm not using Firebase. Does your solution still apply to my scenario?
I was facing this issue for several hours on my IOS device locally. Turns out the fix was to simply restart my XCode & rebuild 🤷♂️
@Dallas62 hi, i'm not getting device token on ios, can you please help me out, i'm using latest version ^4.0.0. Thanks
@ZishanK Test first solutions in this issues. This library is a wrapper of another iOS library (react-native-community/push-notification-ios), if there is any issue, it's not here 😉
Also,
https://github.com/zo0r/react-native-push-notification#usage
onRegistrationError has been added for the case there is an error on registration.
this is also not triggering, don't what's the issue there.