我正在使用AWS SNS在Android和iOS设备中发送推送通知。任何人都可以告诉我如何同时订阅多个设备令牌(不是一个一个)。
我已经有一个设备令牌订阅的代码。
CreateTopicRequest createTopicRequest = new CreateTopicRequest("MyNewTopic");
CreateTopicResult createTopicResult = snsClient.createTopic(createTopicRequest);
//print TopicArn
System.out.println(createTopicResult);
//get request id for CreateTopicRequest from SNS metadata
System.out.println("CreateTopicRequest - " + snsClient.getCachedResponseMetadata(createTopicRequest));
String topicArn = createTopicResult.getTopicArn()
CreatePlatformApplicationResult platformApplicationResult
String platformApplicationArn = ''
long now = System.currentTimeMillis()
println("----before-subscription-------" + now)
platformTokens.each { String platformToken ->
try {
platformApplicationResult = createPlatformApplication(applicationName, platform, principal, credential);
} catch (Exception e) {
System.out.println("----------------" + e)
}
platformApplicationArn = platformApplicationResult.getPlatformApplicationArn();
CreatePlatformEndpointResult platformEndpointResult = createPlatformEndpoint(platform, "CustomData - Useful to store endpoint specific data", platformToken, platformApplicationArn);
String endpointArn = platformEndpointResult.getEndpointArn()
// System.out.println("------------endpointArn--------------" + endpointArn);
//subscribe to an SNS topic
SubscribeRequest subRequest = new SubscribeRequest(topicArn, "application", endpointArn);
snsClient.subscribe(subRequest);
逐个订阅会占用超过100个设备令牌的大量时间。所以请帮我解决我的问题。
由于