react-native-push-notification icon indicating copy to clipboard operation
react-native-push-notification copied to clipboard

Not receiving remote notifications to device.

Open densk1 opened this issue 8 years ago • 1 comments

"react-native": "0.55.0", Tried on both IOS 11.2.6 and iOS 10.3.1. Using both Xcode 9.1 and 9.3

I can get the devices to trigger local notifications, but I can't deliver to a device remotely. The device is plugged in via USB and I'm building the application from Xcode to the device.

I'm sending notifications from a simple node server to APNs and receiving success messages.

{ regId: 
   { device: '0000000aaaaaaaaaa1111111111bbbbbbbbb' },
  error: null }
[ { method: 'apn', success: 1, failure: 0, message: [ [Object] ] } ]

Things I've tried

  • Deleting the App from the device and rebuilding to the device. This invokes a new permission request and I'm updating the new key on the server each time.
  • Tried two different devices

What I've done and double checked

  • [x] Enabling 'Remote Notifications' in Capabilities > Background Modes
  • [x] Enabling 'Push Notifications' in Capabilities
  • [x] Manually installed PushNotificationsIOS from RN docs here
  • [x] Manually added RCTPushNotification.xcodeproj to my Xcode project from node_modules
  • [x] Added libRCTPushNotification.a to 'Link Binary to Libraries

densk1 avatar Apr 04 '18 19:04 densk1

Ok solved,

I started looking at the device console in Xcode and found that the device was receiving the notifications, however, it wasn't passing them on because it didn't see alert, badge, or sound in the notification object.

Server side, I'm using node-pushnotifications Rather than using the data object verbatim from the docs I removed everything and started re-adding items into it one by one.

data: {
    topic: "com.domain.myapp",
    title: 'Message Title',
    body: 'This is the message body',
    badge: 2,
    sound: 'default',
}

While the issue wasn't relevant to this repo, I wanted to document it, in case it comes up in search results.

densk1 avatar Apr 05 '18 17:04 densk1