{
"ApplicationId": "xxx",
"RequestId": "yyy",
"EndpointResult": {
"5551212": {
"DeliveryStatus": "PERMANENT_FAILURE",
"StatusCode": 410,
"StatusMessage": "{\"errorMessage\":\"Unregistered or expired token\",\"channelType\":\"GCM\",\"pushProviderStatusCode\":\"200\",\"pushProviderError\":\"InvalidRegistration\",\"pushProviderResponse\":\"{\\\"multicast_id\\\":752174934090126,\\\"success\\\":0,\\\"failure\\\":1,\\\"canonical_ids\\\":0,\\\"results\\\":[{\\\"error\\\":\\\"InvalidRegistration\\\"}]}\"}",
"Address": "userID"
}
}
一个奇怪的现象是,当应用程序被启动/加载时,Amplify.config也不会调用PushNotification.onRegister函数:
const amplifyConfig = {
Auth: {
identityPoolId: POOL_ID,
region: 'us-east-1'
},
Analytics: {
AWSPinpoint: {
appId: APP_ID,
region: 'us-east-1',
mandatorySignIn: false,
endpointId: '5551212',
endpoint: {
address: 'userID',
channelType: 'GCM',
optOut: 'NONE'
}
}
}
}
PushNotification.onRegister(t => console.log(`Registration token: ${t}`), onRegister && onRegister());
PushNotification.onNotification(n => (console.log(n), onNotification && onNotification(n)));
PushNotification.onNotificationOpened(n => (console.log(n), onNotificationOpened && onNotificationOpened(n)));
Amplify.configure(amplifyConfig);
await Analytics.updateEndpoint({ // address: fcmToken, channelType: "GCM", userId: uid, optOut: 'NONE', });
看起来它起作用了,我可以向我的设备发送推送通知。但是在大约20分钟后,如果我试图再次发送通知,我会得到以下错误: "StatusCode": 410, "StatusMessage": "{"errorMessage":"未注册或已过期的令牌 有任何想法为什么会出现这个问题? - Munish