Not receiving Push Notification in Standalone apps


#1

Hello,

I was testing out Push Notifications on a standalone app and I found that I would only receive Push if I have expo installed on the phone. Also the icon and name of the application were of Expo. I am checking for Android.

When I uninstalled the app, I did not receive any push message at all.

Its clear that if I am receiving push, I have configured registerForPushNotificationsAsync properly.

I have also added _handleNotification method as mentioned in the docs to handle ios Notifications.

Also here is what my app.json looks like.

i’ve removed slug

{
  "expo": {
    "name": "8om Trckr",
    "description": "Advanced Inventory Tracking Solution",
    "sdkVersion": "21.0.0",
    "version": "1.0.0",
    "orientation": "portrait",
    "primaryColor": "#3b67ff",
    "icon": "./512x512.png",
    "notification": {
      "icon": "./48x48.png",
      "androidMode": "default"
    },
    "loading": {
      "icon": "./splash-icon.png",
      "exponentIconColor": "white",
      "backgroundColor": "#4a49ff",
      "hideExponentText": true
    },
    "scheme": "trckr",
    "ios": {
      "bundleIdentifier": "io.eom.trckr",
      "buildNumber": "1.0.0",
      "icon": "./512x512_ios.png"
    },
    "android": {
      "package": "io.eom.trckr",
      "versionCode": 1,
      "permissions": [
        "CAMERA"
      ]
    }
  }
}

#2

hey, can you try removing the "permissions" key from android? you may have overwritten the default permissions (that includes push notifications) and now you only have camera permissions.

if that fixes the problem, I believe the correct permission you need to add is com.google.android.c2dm.permission.RECEIVE to your list. if not, I’m testing some other things right now and will get back to you in a bit


#3

Hey @samee Thanks for the reply.

So I was mixing a lot of things when I tested. I tested it again with a fresh apk installs on two phones. Made sure that the bundle was the latest bundle and then did a test and this time I received the notification.

But again, it was just one of the tests. I would be doing more tests to check different scenarios.


#4

Ive narrowed down the issue to the case where I dont receive notification

Here is the setup.

I have installed the standalone version of the build as apk on an android phone. I would receive the notification if my app is still running in the background.

I would NOT get any notification if I have completely killed the application, basically if the app is not there in the background application tray.

I cannot build an ios version yet. So that is not tested.

@samee


#5

Seems like the same thread is already open.


#6

bump

Any update on why the app does not get notifications (I’m using local only) when the app is in background/ killed from background. I am facing a similar issue where the push notification shows up only when I open the app again.


#7

Yeah I’d love to get an answer on this. Do local notifications work when you kill the app?