Search code examples
androidreact-nativevisual-studio-app-center

React Native AppCenter Push - Notifications when app is in background


I'm using React Native Microsoft AppCenter which leverages Firebase Cloud Messaging for an Android app.

  • I am receiving the push notifications when the app is open,
  • When the app is in the background the notification appears only in the system tray but no actual Notification.

I have to open the tray to see the notification. Any help would be greatly appreciated


Solution

  • So I did find the answer in the end. Just in case this is something anybody else trips up on...

    You'll need to add the 'sound' key and 'default' value to custom data.

    "notification_content": {
      "name": "Some Name",
      "title": "Some Title",
      "body": "Some...body",
      "custom_data": { "sound": "default" }
    },
    "notification_target": {
      "type": "devices_target",
      "devices": ["Some device ID"]
    }