Hi!
I’m trying to follow these directions to setup FCM on an ExpoKit project. Firebase analytics is definitely recognizing that my client is connecting. I’ve tried sending a notification using Firebase’s tester to all users of my app (aka just me). Firebase says the message is delivered, but I haven’t seen anything in the notification tray on the device.
My next step in troubleshooting was to try to send a notification to my specific device ID (as most FCM tutorials suggest), but, I’m not sure how to get it via Expo’s FCM setup. Even though the Expo Notifications
API is generally geared towards non-detached users, I was thinking that Expo.Notifications.getDevicePushTokenAsync()
may still work detached because Expo’s push server probably isn’t involved in obtaining a token from the device. However, the current API documentation only mentions obtaining a GCM token. Is it possible to obtain the FCM token from Expo’s API?
My other angle for troubleshooting was if notification channels could be affecting this. (I’m using an Android 7 device so I’m not sure if this configuration even matters). Either way, I’ll be supporting Android 8, so wondering if the Expo Notification API’s for creating notification channels should still work when detached (again, seems like a negotiation with the device, doesn’t seem like Expo’s servers should be involved until the notification is sent).
For what it’s worth, @jesse’s suggestion seems to jive with other tutorials for adding FCM (see this one, and Firebase’s own quickstart). The major difference being that the tutorials have you creating your own FCM service classes instead of using ExpoFcmMessagingService
and ExpoFcmInstanceIDService
, and that they don’t cover getting the device token over to JavaScript. It seems like leaning on Expo’s existing service classes is the much better path, since there already is some JS integration. Additionally, the vanilla React Native path (using react-native-firebase) asks us to do things that I believe would break other parts of an ExpoKit project, like upgrading to Gradle 4.4.
Thank you!