问题描述
下午好,希望你们度过愉快的一天,我已经使用 expo 裸工作流构建了一些应用程序,并且需要使用 Expo Notification,我正在遵循 expo notification documentations 中的所有说明,并且 { {3}},到 fcm configurations,但是,当我尝试获取 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);
};
App.js
{
"name": "myapp","displayName": "myapp","expo": {
"name": "myapp","slug": "myapp","version": "1.0.0","assetBundlePatterns": [
"**/*"
]
},"android": {
"googleServicesFile": "./google-services.json","useNextNotificationsApi": true
}
}
Package.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
}
截图: setup firebase
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)