下午好,希望你们今天过得愉快,我已经在使用 expo 裸工作流构建一些应用程序,并且需要使用 Expo Notification,我正在遵循所有说明,从expo 通知文档和fcm 配置到设置 firebase,但是,当我尝试获取 expoToken 时,我收到了这个警告,如下所示:
Error: Encountered an exception while calling native method: Exception occurred while executing exported method getDevicePushTokenAsync on module ExpoPushTokenManager: Failed resolution of: Lcom/google/firebase/iid/FirebaseInstanceId;
我已经确定我的包名和我在firebase中注册的包名一样,你们能帮帮我吗?请:slight_smile:
这是附加信息:
获取世博通证
const getToken = async () => {
console.log("TOKEN CHECK");
const { status: existingStatus } =
await Notifications.getPermissionsAsync();
let finalStatus = existingStatus;
if (existingStatus !== "granted") {
const { status } = await Notifications.requestPermissionsAsync();
finalStatus = status;
}
if (finalStatus !== "granted") {
alert("Failed to get push token for push notification!");
return;
}
token = (await Notifications.getExpoPushTokenAsync()).data;
console.log(token);
};
应用程序.js
{
"name": "myapp",
"displayName": "myapp",
"expo": {
"name": "myapp",
"slug": "myapp",
"version": "1.0.0",
"assetBundlePatterns": [
"**/*"
]
},
"android": {
"googleServicesFile": "./google-services.json",
"useNextNotificationsApi": true
}
}
包.json
{
"main": "index.js",
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"web": "expo start --web",
"start": "react-native start"
},
"dependencies": {
"@dudigital/react-native-zoomable-view": "^1.0.16",
"@react-native-async-storage/async-storage": "^1.15.5",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "^6.0.0",
"@react-native-firebase/app": "^12.0.0",
"@react-native-firebase/firestore": "^12.0.0",
"@react-native-firebase/storage": "^12.0.0",
"@react-native-picker/picker": "^1.16.1",
"@react-navigation/material-bottom-tabs": "^5.3.15",
"@react-navigation/native": "^5.9.4",
"@react-navigation/stack": "^5.14.5",
"expo": "~41.0.1",
"expo-av": "~9.1.2",
"expo-image-manipulator": "~9.1.0",
"expo-image-picker": "~10.1.4",
"expo-notifications": "~0.11.6",
"expo-splash-screen": "~0.10.2",
"expo-status-bar": "~1.0.4",
"expo-updates": "~0.5.4",
"expo-web-browser": "~9.1.0",
"firebase": "^8.6.5",
"moment": "^2.29.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "~0.63.4",
"react-native-calendars": "^1.1263.0",
"react-native-custom-qr-codes-expo": "^2.2.0",
"react-native-datepicker": "^1.7.2",
"react-native-gesture-handler": "~1.10.2",
"react-native-linear-gradient": "^2.5.6",
"react-native-orientation-locker": "^1.3.1",
"react-native-paper": "^4.9.1",
"react-native-raw-bottom-sheet": "^2.2.0",
"react-native-reanimated": "~2.1.0",
"react-native-render-html": "^5.1.1",
"react-native-responsive-screen": "^1.4.2",
"react-native-safe-area-context": "^3.2.0",
"react-native-screens": "~3.0.0",
"react-native-shimmer-placeholder": "^2.0.7",
"react-native-svg": "12.1.0",
"react-native-unimodules": "~0.13.3",
"react-native-vector-icons": "^8.1.0",
"react-native-web": "~0.13.12",
"react-native-webview": "^11.6.2"
},
"devDependencies": {
"@babel/core": "^7.9.0"
},
"private": true
}
截图: 一些图片