getDevicePushTokenAsync error on bare workflow

Viewed 638

I implemented push notification on managed workflow which is working properly but when I eject from managed workflow, I am getting error at line

pushToken = (await Notifications.getExpoPushTokenAsync()).data;

Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Default FirebaseApp is not initialized in this process com.luciajane.taskuser. Make sure to call FirebaseApp.initializeApp(Context) first.

I passed experienceId but still getting error?

pushToken = (await Notifications.getExpoPushTokenAsync({experienceId: "@luciajane/task-user"})).data;

1 Answers

I found reason. You have to setup by making new project on firebase then download google-services.json file and add that to your expo project. As expo mentioned Firebase Cloud Messaging is required for all managed and bare workflow Android apps made with Expo.For setup follow this link https://docs.expo.io/push-notifications/using-fcm/

Related