Silent notifcations with Expo

#1

Hi.

Is it possible to push silent notifications (notifications without sound and badge) with Expo? I’ve been googling for a while without any luck…
If this is possible, how do you do it? Will this work even if the user rejects notifications?

Thanks in advance.

EDIT:
I’m sorry I was a bit unclear about what I meant with silent notifications. I basically mean a notification that the user never can see. I want this because of real-time updates without using sockets or polling for ex. But I dont want the user to get notifications when the app is closed because those changes arent that important, I just want to update in real time (without refreshing).

0 Likes

#2

Hi,

Have you looked through these options?

https://docs.expo.io/versions/latest/sdk/notifications.html

0 Likes

#3

hey, you can make a notification without sound pretty easily:

const notification = {
     title: 'This is a title',
     body: 'This is the body text of the local notification',
     android: {
       sound: false
     },
     ios: {
       sound: false
     }
 }

not sure what you mean about the badge. you can change the icon by setting an icon value inside android.

If the user rejects notifications permissions (at install for android and runtime for iOS), the notifications will not show up

0 Likes

#4

I’m sorry I was a bit unclear about what I meant with silent notifications. I basically mean a notification that the user never can see. I want this because of real-time updates without using sockets or polling for ex. But I dont want the user to get notifications when the app is closed because those changes arent that important, I just want to update in real time (without refreshing).

0 Likes

#5

I don’t believe this is supported, but you can make a feature request at https://expo.canny.io/feature-requests/

0 Likes

#6

+1
@mtnptrsn did you find some way around it?

0 Likes

#7

I also have a similar issue to use expo push notification to do some real time update in the app.

In this doc (https://docs.expo.io/versions/latest/guides/push-notifications.html) the registration returns if user rejects allowing notification.

// Stop here if the user did not grant permissions
  if (finalStatus !== 'granted') {
    return;
  }

I wonder if we keep doing the rest instead of returning (so basically ignore user permission), does the app still receive notification? on OS level the notification wont show up since user has already reject allowing notification for the app, so does it turn into silent notification this way?

0 Likes