小编Rya*_*yan的帖子

如何使用Android SDK为Amazon推送SNS设置应用ARN

我正在尝试注册我的Android设备以接收推送通知,但亚马逊服务器返回错误,说它无法找到我的PlatformApplicationArn.我使用他们的sdk设置它,但它似乎没有找到它.

这是错误:AWS错误消息:无效参数:PlatformApplicationArn原因:没有必需参数的值

这是发送它的代码:

String platformApplicationArn = "arn:aws:sns:us-east-1:897955111111:app/GCM/com.myapp";
AWSCredentials awsCredentials = new BasicAWSCredentials("XXXXXXXX", "XXXXXXXXXXXXXXXXXXXXX");
pushClient = new AmazonSNSClient(awsCredentials);
CreatePlatformEndpointRequest createPlatformEndpointRequest = new CreatePlatformEndpointRequest();
String customPushData = "my custom data";
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setCustomUserData(customPushData);
platformEndpointRequest.setToken(pushNotificationRegId);
platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn);
CreatePlatformEndpointResult result = pushClient.createPlatformEndpoint(createPlatformEndpointRequest);
Run Code Online (Sandbox Code Playgroud)

android amazon-sns

2
推荐指数
1
解决办法
6388
查看次数

标签 统计

amazon-sns ×1

android ×1