我升级了我的世博推送通知,每当我在Android上运行它时,我都会得到以下错误:
在模块getDevicePushTokenAsync上执行导出方法ExpoPushTokenManager时发生异常。请设置您的项目ID。与firebase服务器API通信需要一个有效的防火墙项目ID :它用Goolge标识您的项目。
有人能告诉我我应该把项目ID放在哪里吗?我在我的config.js
文件中的项目中链接了它,但是我觉得它也应该在我的app.json
文件中,只是不能100%确定它在哪里。
{
"expo": {
"name": "Galavant",
"slug": "Galavant",
"platforms": ["ios", "android", "web"],
"version": "2.0.8",
"orientation": "portrait",
"icon": "./assets/logo.png",
"splash": {
"image": "./assets/logo_original.png",
"resizeMode": "contain",
"backgroundColor": "#ffffff"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"assetBundlePatterns": ["**/*"],
"ios": {
"usesAppleSignIn": true,
"infoPlist": {
"NSCameraUsageDescription": "So you can add photos to your profile.",
"NSPhotoLibraryUsageDescription": "So you can add photos to your profile.",
"NSLocationWhenInUseUsageDescription": "So you can connect with people nearby."
},
"supportsTablet": true,
"bundleIdentifier": "com.test.test",
"buildNumber": "0.0.1",
"config": {
"googleSignIn": {
"reservedClientId": "com.googleusercontent.apps.12346789"
}
}
},
"android": {
"package": "com.test.test",
"useNextNotificationsApi": true,
"versionCode": 5,
"config": {
"googleMaps": {
"apiKey": "asdkjfkasjdf9837983rlkajshf"
},
"googleSignIn": {
"apiKey": "asdkjfkasjdf9837983rlkajshf",
"certificateHash": "33345w4sdfasdkjfkasjdf9837983srlkajshf"
}
},
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"CAMERA",
"MANAGE_DOCUMENTS",
"READ_CONTACTS",
"READ_CALENDAR",
"WRITE_CALENDAR",
"READ_EXTERNAL_STORAGE",
"READ_PHONE_STATE",
"RECORD_AUDIO",
"USE_FINGERPRINT",
"VIBRATE",
"WAKE_LOCK",
"WRITE_EXTERNAL_STORAGE",
"com.anddoes.launcher.permission.UPDATE_COUNT",
"com.android.launcher.permission.INSTALL_SHORTCUT",
"com.google.android.c2dm.permission.RECEIVE",
"com.google.android.gms.permission.ACTIVITY_RECOGNITION",
"com.google.android.providers.gsf.permission.READ_GSERVICES",
"com.htc.launcher.permission.READ_SETTINGS",
"com.htc.launcher.permission.UPDATE_SHORTCUT",
"com.majeur.launcher.permission.UPDATE_BADGE",
"com.sec.android.provider.badge.permission.READ",
"com.sec.android.provider.badge.permission.WRITE",
"com.sonyericsson.home.permission.BROADCAST_BADGE"
]
},
"notification": {
"icon": "./assets/PushNotification.png"
}
}
}
发布于 2020-12-26 22:01:27
最后我做了几件事。首先,我创建并添加了google-services.json
文件。我用项目ID添加了"web"
部分,最后用useNextNotificationsApi
更新了"android“部分
"android": {
"package": "com.test.test",
"googleServicesFile": "./google-services.json",
"useNextNotificationsApi": true,
"versionCode": 10,
"config": {
"googleMaps": {
"apiKey": "123456789"
},
"googleSignIn": {
"apiKey": "123456789",
"certificateHash": "123456789asdfasdf"
}
},
"permissions": [
"ACCESS_COARSE_LOCATION",
"ACCESS_FINE_LOCATION",
"CAMERA",
"USE_FINGERPRINT",
"VIBRATE"
]
},
"web": {
"config": {
"firebase": {
"projectId": "testprojectID",
"apiKey": "123456789",
"measurementId": "measurementid123"
}
}
},
https://stackoverflow.com/questions/65396012
复制相似问题