push notification on Android 8+ with Expo sdk 28

#1

Hi, I’m build an app that requires remote push notification, that are sent from our server when some activity happens.
We are using Expo sdk 28, and I’m aware of the Breaking changes that comes with it for Android 8+.

According to the documentation https://docs.expo.io/versions/v28.0.0/guides/notification-channels :

The only thing I need to implement this code:

componentDidMount() {
  // ...
  if (Platform.OS === 'android') {
    Expo.Notifications.createChannelAndroidAsync('reminders', {
      name: 'Reminders',
      priority: 'max',
      vibrate: [0, 250, 250, 250],
    });
  }
}

where ‘reminders’ is the channelId I need to use when I want to send the notification.
I did’t set permission For NOTIFICATIONS, in the app.json, as per sdk 28, is not required.

I’m able to receive notifications on iOS devices, and Android 7<, but not on Android 8+.

Is there some else I need to implement in order to make it work?

Thanks

Upcoming changes to the Expo push notification service (Summer 2018)
#2

How are you sending the pushes? Are you using FCM or GCM?

#3

I’m using GCM.

curl -H "Content-Type: application/json" -X POST [https://exp.host/--/api/v2/push/send](https://exp.host/--/api/v2/push/send) -d '{
  "to": "ExponentPushToken[xxxxxxxxxxxxxxxxxxxxxx]",
  "title":"hello",
  "body": "world"
}'

actually I have discovered that the notification arrives when I’m using the app, but not when the app is in background. This is happening in more than one devices running Android 8+.
I also checked the phone settings for notification, and it is ON, but I don’t see anything under Categories, where I suppose I should see the name “Reminders” of my channel, that I setup with this code:

componentDidMount() {
  // ...
  if (Platform.OS === 'android') {
    Expo.Notifications.createChannelAndroidAsync('reminders', {
      name: 'Reminders',
      priority: 'max',
      vibrate: [0, 250, 250, 250],
    });
  }
}

what am I missing? do I need some other permission?

#4

I’m using GMC

#5

We have the same issue

closed #6

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