react-native-push-notification: onRegister callback is never called, both on Android and iOS

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.

About this issue

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

Most upvoted comments

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

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