Amplify和React Native,如何使用endpointId更新端点



这段代码成功地在AWS PinPoint中创建了一个端点,到目前为止,我可以在分析部分看到端点计数上升:

import { Analytics } from 'aws-amplify';
import { PushNotification } from '@aws-amplify/pushnotification';
PushNotification.onRegister( async (token) => {
const { attributes: {sub} } = await Auth.currentUserInfo();
Analytics.updateEndpoint({
endpointId: 'my-endpoint-id',
address: token,
optOut: "NONE",
userId: sub,
channelType: "APNS",
}).then((response) => {
console.log('created', response);
}).catch((error) => {
console.log('Error updating endpoint', error);
});
});

我可以使用上面生成的"令牌"成功地从PinPoint发送推送通知,但是当我尝试使用"my- endpointid "我得到一个错误,端点不存在。我无法在PinPoint中找到端点列表,甚至无法检查已创建的内容。

我也试过了:

address: {
token: token,
endpointId: 'my-endpoint-id',
},

这也不起作用。我希望有人知道如何获得端点ID来正确保存。

我也面临同样的问题,这就是我怎么做的,但不工作

Analytics.configure({
AWSPinpoint: {
appId: '<appid>',
region: '<region>',
clientContext: {
clientId: 'mynewendpoint',
appTitle: 'bunderId',
appVersionCode: 'version',
},
},
});
const endpointInfo = await Analytics.updateEndpoint({
address: 'mynewendpoint',
channelType: 'GCM',
userId: 'mynewendpoint',
});

相关内容

最新更新