Hey, I am trying to use expo-notification service with firebase but it does not seems to work and returns an error saying:
Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
I uploaded my firebase server-key and have also passed experienceId in getDevicePushTokenAsync.
This is my app.json
{
"expo": {
"name": "bj-app",
"slug": "bj-app",
"version": "1.0.0",
"orientation": "portrait",
"icon": "./assets/icon.png",
"splash": {
"image": "./assets/splash.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"supportsTablet": true
},
"android": {
"adaptiveIcon": {
"foregroundImage": "./assets/adaptive-icon.png",
"backgroundColor": "#FFFFFF"
},
"package": "com.yourcompany.yourappname",
"googleServicesFile": "./google-services.json",
"useNextNotificationsApi": true,
"softwareKeyboardLayoutMode": "pan"
},
"plugins": [
"@react-native-firebase/app",
"@react-native-firebase/perf",
[
"expo-notifications",
{
"color": "#ffffff",
"mode": "development"
}
]
],
"web": {
"favicon": "./assets/favicon.png"
}
}
}
This is my code for getting notification token:
let token;
const { status: existingStatus } = await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== "granted") {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== "granted") {
Alert.alert("Notification failed");
return;
}
token = (
await Notifications.getDevicePushTokenAsync({
experienceId: "@name/app",
})
).data;
return token;
}
- Managed Workflow
- 0.37