Search code examples
androidreact-nativepush-notificationpubnub

React Native Android remote push notifications not showing up


I am using the react-native-push-notification package and PubNub push notifications to handle the remote notifications. This all works on iOS just fine and I'm getting the notification data coming in from the onNotification method on android but there is no actual notification popping up on the screen as I would expect. Am I missing a configuration on the FCM side maybe or a specific permission check I need to ask for to make sure remote notifications can be shown on android devices?

I've followed the manual steps on the react-native-push-notification package to a T and triple checked I didn't miss something


Solution

  • This GCM bit I was passing to Pubnub was this

    "pn_gcm": {
        "data": {
          "title_for_mobile": "George Washingtons's phone has moved outside of the group",
          "summary_for_mobile": [ "George Washingtons's phone has moved outside of the group" ],
          "data": {
            "action": "radiusTrigger",
            "userId": 6,
            "groupId": 8
          }
        }
      }
    

    and the title_for_mobile wasn't sending it to my phone as a push notification so I had to change it to

    "pn_gcm": {
        "data": {
          "message": "George Washingtons's phone has moved outside of the group",
          "data": {
            "action": "radiusTrigger",
            "userId": 6,
            "groupId": 8
          }
        }
      }
    

    And now it shows the notification on android