- SDK Version: 41
- Platform: Android
- Expo library: expo-notifications
Hello!
I created an app with the managed workflow of expo (expo init …), in which I used expo-notifications (without fcm). Everything worked out fine. Now I converted it into a standalone app (expo android:build -t apk), and I followed the instructions on
https://docs.expo.io/push-notifications/using-fcm/
to continue using expo-notifications without Expo Go.
That means, I created a firebase project, added my android app with the package name provided by app.json, and downloaded and checked the google-services.json file.
The one thing I couldn’t do was step 3 of integrating my app to the firebase project, “Add Firebase SDK”, since it is a standalone app which used to be a pure expo app (created through the command “expo init …”), and I don’t have the android folder or any gradle files described in that step.
I am relatively new to firebase and react native (to coding in general), so I don’t understand how I can execute this step without my app being a bare workflow app or pure react native (or if I even can skip step 3 in that case).
After “finishing” the app integration into my firebase project (missing step 3), I uploaded the credentials via expo push:android:upload --api-key , being replaced by the server key token in the cloud messaging tab in the firebase project settings.
My problem now is, that due to the transformation of my app, I can’t use expo-notifications anymore (the token is not generated in the first place), and I don’t know if it’s because of me skipping step 3 or if it’s something else.
I changed nothing in my code, since the documentation says using managed workflow it’s not necessary to adapt the code after transforming the app into a standalone one. Once I tried replacing
token = (await Notifications.getExpoPushTokenAsync()).data;
with
token = (await Notifications.getDevicePushTokenAsync()).data;
in the async function registerForPushNotificationsAsync(), just in case. Didn’t change anything, though. As I said, sorry, I am very unexperienced in that area, probably I’m just missing something important.
Please help me, I have a deadline (till Wednesday at the latest) and I just can’t figure this out.
Thank you very much in advance!
Cheers,
Bianca