Push Notification Issues


#1

I integrated push notifications with FCM as described in the docs. SDK: 27.0.0

  1. When Im sending push via nodejs SDK it works from my dev (nodejs) but when I run the code in AWS Lambda Im randomly getting “request to https://exp.host/--/api/v2/push/send failed, reason: socket hang up” the whole request takes less then 100ms so its not timeout issue.
    Is there any other API to send push to Expo server?
  2. In times when it works Im getting a push with Expo icon, and not my application icon.
  3. Notifications always seen in Android systray both when app in Foreground and Background. I tried sending with body and without, but its the same result. How can I omit showing systray if app is in foreground as it default behaviour in many apps?
  4. I tried using Notifications.getDevicePushTokenAsync instead and send push directly from FCM console, in this case I got 2 notifications with same content: one with Expo Icon and one with my app Icon.
    So how can I use Notifications.getDevicePushTokenAsync and still get one notification?

#2

Hi, I can help answer the server-side part of your question. This could be due to a temporary outage. Retrying with exponential backoff (e.g., 1 second, 2 seconds, 4 seconds, etc…) is a good strategy for this. It’s what we do when connecting to Google’s own services per their recommendation, for example.


#3

Hi @veedeo!

  1. Have you specified a push notification icon in app.json?
  2. You should be able to call https://docs.expo.io/versions/latest/sdk/notifications#exponotificationsdismissnotificationasynclocalnotificationid on the notification when you receive it.
  3. We need to do a better job documenting this, I’ll put it on my list. You need to use a specific format when sending FCM notifications yourself. Specifically don’t use the “notification” object:
{
            to: [DEVICE TOKEN]
            data: {
              experienceId: "@[USERNAME]/[SLUG]",
              title: [TITLE],
              message: [MESSAGE],
              body: [BODY]
            }
          }

#4

I think the problem is in expo-node itself, I fixed it by using API directly:

  async SendPush(messages) {
    const promises = _.chunk(messages, 100).map(chunk => axios.post('https://exp.host/--/api/v2/push/send', chunk));
    const results = await Promise.all(promises);
    console.log('SendPushDirect', results);
  }

#5

I found another issue on Android. Galaxy 6 and 8. It maybe related to launchMode.

  1. When the app is killed and pressing on systray notification, opens the app and gets event as expected. But then if I minimize the app and tap on app icon it loads everything from scratch. And taping new systray notifications will reopen the app, but no event is received.
  2. Open app via home icon, app is foregrounded, when new push arrives Im getting Notification events as expected. If I tap on systray notification it loads new instance of the app and im not able to get events enymore.

closed #6

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.