我们按照文档中所说的expo通知指南进行操作,但是在通知android设备(占其中的30%)时遇到问题,除了效率高之外,我们发现效率低某些设备的通知到达时间在5到10分钟之间,我们认为通知错误是由于Expo版本在Android和ios中均显示为“ 1.0.4”和在iOS中显示为“ 37.0.0” ,我的设置是:
"expo": {
"name": "DavidVas",
"slug": "davidvas",
"platforms": [
"ios",
"android"
],
"sdkVersion": "37.0.0",
"notification": {
"icon": "./assets/images/transparentIcon.png",
"color": "#000000",
"androidMode": "collapse",
"androidCollapsedTitle": "DavidVas",
"iosDisplayInForeground": true
},
"loading": {
"icon": "./assets/images/splash.png",
"hideExponentText": false
},
"version": "1.0.4",
"orientation": "portrait",
"icon": "./assets/images/icon.png",
"scheme": "davidvas",
"splash": {
"image": "./assets/images/splash.png",
"resizeMode": "contain",
"backgroundColor": "#000000"
},
"androidStatusBar": {
"backgroundColor": "#000000",
"barStyle": "light-content"
},
"updates": {
"fallbackToCacheTimeout": 0
},
"ios": {
"supportsTablet": true,
"bundleIdentifier": "com.f13.david.davidvas",
"icon": "./assets/images/icon.png",
"buildNumber": "2"
},
"description": "",
"android": {
"package": "com.f13.david.davidvas",
"versionCode": 7,
"googleServicesFile": "./google-services.json",
"icon": "./assets/images/icon.png",
"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"
]
}}
if (Platform.OS === 'android') {
Notifications.createChannelAndroidAsync('signals', {
name: 'default',
sound: true,
priority: 'high',
vibrate: [0, 250, 250, 250],
});
Notifications.createChannelAndroidAsync('notifications', {
name: 'default',
sound: true,
priority: 'high',
vibrate: [0, 250, 250, 250],
})}