expo: Push notifications for Standalone Android do not work

Environment

Environment: OS: Linux 3.16 Node: 9.8.0 Yarn: 1.3.2 npm: 5.6.0 Watchman: 4.9.0 Xcode: N/A Android Studio: 2.3 AI-162.4069837

Packages: (wanted => installed) expo: ^23.0.0 => 23.0.1 react: 16.0.0 => 16.0.0 react-native: https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz => 0.50.3

Diagnostics report: https://exp-xde-diagnostics.s3.amazonaws.com/jozsef-b2629d43-26e8-4f22-baf2-dd8a97831e72.tar.gz

Standalone running on Samsung Galaxy s8

Steps to Reproduce

When the applications starts, the user is asked to log in. An expo push token is created and sent to backend. To rule out any backend issues, I grab the token and call the expo server directly via Postman to send a notification.

Expected Behavior

The android device should get a notification

Actual Behavior

The device is not receiving any notifications. Expo server first responds with 200 OK, then after a few tries it responds:

{
    "data": [
        {
            "status": "error",
            "message": "SNS failed to send the notification (reason: EndpointDisabled, status code: 400).",
            "details": {
                "error": "DeviceNotRegistered",
                "sns": {
                    "statusCode": 400,
                    "reason": "EndpointDisabled",
                    "__message": "Endpoint is disabled"
                }
            }
        }
    ]
}

The app is granted permissions otherwise the code would not have generated the push token. The app does however not prompt for permission, as if a grant from a previous installation is still being in use.

I have tried:

  • clearing expo data
  • reinstalling expo
  • reinstalling standalone app
  • rebuilt the standalone app with different package names, and different slug
  • rebuilt the standalone app with declared permissions in the app.json:
      "permissions": [
        "CAMERA",
        "ACCESS_FINE_LOCATION",
        "com.google.android.c2dm.permission.RECEIVE",
        "READ_EXTERNAL_STORAGE",
        "READ_INTERNAL_STORAGE"
      ]

Everything works well running in Expo, as soon as i build the standalone apk it no longer works.

snack: https://snack.expo.io/HJFH2l95f

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Reactions: 5
  • Comments: 27 (6 by maintainers)

Most upvoted comments

I can say that we have been able to sporadically reproduce the problem and we are investigating it further.

Hey guys,

We’re aware of this issue and are sorry for the inconveniences it has caused. Unfortunately, with SDK26 being released this week our resources and time are limited and sharply focused on the release. It may be a couple of days before we’re able to dig in and resolve this issue.

Adam

Hi! Sorry about this issue. We’ve been working hard on a fix but it unfortunately required a lot of changes on our end. We just put up a guide on using FCM for push notifications which should fix the problem: https://docs.expo.io/versions/latest/guides/using-fcm. Please let us know if you run into problems with the new system and sorry for the trouble.

Hello guys!

If anyone else is having issues with receiving notifications on Android, Google FCM works like a charm. It is really easy to setup, took me just 2 minutes (plus 15min building lol). Basically, you just add a key to your app.json and then keep sending messages as usual. Official guide on using FCM

I’m facing the same problem: notifications arrive on standalone iOS app but they never show up on standalone Android app.

Any update on a fix for this?

Thanks!

The FCM solutions works. Followed your guide to set it up and tried it out on Android stand alone (on a very old Samsung S3, but still) and it runs smoothly now. Haven’t been able to try stand alone on iOS but guess that still works. Works fine when running through Expo Client. Thank you @jesseruder for this solution!

Minor fix to @Jozsef86 's snack. To show revieved notification. https://snack.expo.io/HJFH2l95f