Push notifications using native tokens and Expo.


#1

Hello,
I’m rewriting an app using Expo. We have hundreds of thousands of push tokens saved in our database, so I’m trying to keep then instead of using Expo’s push notifications (that work right out of the box, no issues there).
I’m already receiving the token using getDevicePushTokenAsync (standalone app), but when I send a notification I get nothing on my device.
I read a couple of guides that say that you need to modify the app’s manifesto, but I really don’t want to detach from Expo.
¿Is there something that can be done about this?

Thanks in advance,
Gabriel.


#2

You need to format your notification payload in a specific format that is not a public API and isn’t documented right now. You don’t need to modify the manifest, but the format is implied by the Expo client source code.

Android: https://github.com/expo/expo/blob/e543a7be75dfa4f6a66a98070e011e17c53f0b5d/android/expoview/src/main/java/host/exp/exponent/notifications/ExponentNotification.java#L29
iOS: https://github.com/expo/expo/blob/d718b4b8c390c116837c4d440c06085cca8db5b0/ios/Exponent/Kernel/Services/Notifications/EXRemoteNotificationManager.m#L85 (Same as a regular iOS payload, with a “body” field for arbitrary data. You may need to specify a field named “experienceId” with @yourexpousername/yourprojectslug as well.)


closed #3

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