I have a critical requirement for my app where I need to silently process PUSH notifications in both Android and IOS.
I've already made a prototype that receives the notifications, but I didn't find a way to avoid the prompt and the sound.
Is that even possible using Expo? should I use pure react-native instead?
One thing to note is in Expo Go the
Notifications.setNotification()does not fire when the app is backgrounded. Instead the default notification handler which shows the content appears.You can send a "silent" notification by removing the
titleandbodyfrom the message being sent to Expo Push Notifications. Then use thedatato provide the details for the notifications.Here is a
notification-handler.tsthat would add as a side-effect the background notification handler.For this to work in iOS you also need to add to the
app.jsontheUIBackgroundModesarray withremote-notificatione.g. with background fetch support as wellThis answer combines information from
In addition for this to work with iOS you need to add
_contentAvailable: trueto the payload. e.g.