question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

onRegister callback is never called, both on Android and iOS

See original GitHub issue

Hey there,

It seems like the onRegister callback is never activated. I’ve tried on both iOS and Android platform. I have managed to receive a prompt asking for Notifications permissions.

I also followed the stack trace all the way through callNative, which is triggered with a function named “register” and the appropriate callback ( _onRegister ) , it is never fired.

This is how I configure my PushNotification :

componentDidMount() {
    PushNotification.configure({
      // (optional) Called when Token is generated (iOS and Android)
      onRegister: (token) => {
        // ...
      },
      onNotification: (notification) => {
        // ...
      },
      senderID: "< A SENDER ID >",
      popInitialNotification: true,
      requestPermissions: true
    });
  }

I’ve truncated the code in both onRegister and onNotification, but it triggers a fetch call to a remote API. I’ve switched the logic to a simple console.error(token) and nothing.

Also, the remote debugger never stops if I put a debugger; at the beginning of onRegister

I am working with the latest version of this package as well as react-native 0.34-rc.0 on iOS 10 and Android 6.0.0

Finally, I did test push notifications for both platforms on PushWatch and it does work.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:12
  • Comments:21 (8 by maintainers)

github_iconTop GitHub Comments

11reactions
ivpusiccommented, Sep 28, 2016

for me problem was that with xcode 8 Push Notification capability was disabled. I enabled it again, and then it worked

2reactions
scarmuegacommented, Sep 24, 2016

Same here. react-native 0.34. Both iOS and Android, same symptoms.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native Push Notification onRegister token is null
For some reason, when i open the app for the first time after i installed it on the mobile device ( iOS or...
Read more >
react-native-push-notification - npm
React Native Local and Remote Notifications for iOS and Android ... (optional) Called when Token is generated (iOS and Android) onRegister: ...
Read more >
onRegistered not called on Android 9.0 Pie : r/androiddev
Google Cloud Messaging - onRegistered not called on Android 9.0 Pie ... For some reason, this callback method is never called on devices ......
Read more >
javascript - Pushwoosh callback on register device - Stack Overflow
There are two ways to transmit registration to the app and this way (broadcast) is not supported by Phonegap Pushwoosh plugin yet. Somehow...
Read more >
React Native Onregister Event Not Working Ios - ADocLib
Similarly the onRegister callback will not be called until. ... not required for local Called when Token is generated iOS and Android onRegister:...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found