use of com.amazonaws.services.sns.model.CreatePlatformEndpointResult in project krypton-android by kryptco.
the class SNSTransport method registerWithAWS.
public synchronized void registerWithAWS() throws TransportException {
try {
AmazonSNSClient client = getClient();
CreatePlatformEndpointRequest request = new CreatePlatformEndpointRequest().withPlatformApplicationArn(PLATFORM_APPLICATION_ARN).withToken(token);
CreatePlatformEndpointResult result = client.createPlatformEndpoint(request);
setEndpointARN(result.getEndpointArn());
HashMap<String, String> enabledAttribute = new HashMap<>();
enabledAttribute.put("Enabled", "true");
SetEndpointAttributesRequest enableRequest = new SetEndpointAttributesRequest().withEndpointArn(endpointARN).withAttributes(enabledAttribute);
client.setEndpointAttributes(enableRequest);
} catch (AmazonClientException e) {
throw new TransportException(e.getMessage());
}
}
use of com.amazonaws.services.sns.model.CreatePlatformEndpointResult in project oxAuth by GluuFederation.
the class PushSnsService method createPlatformArn.
public String createPlatformArn(AmazonSNS snsClient, String platformApplicationArn, String token, User user) {
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn);
platformEndpointRequest.setToken(token);
String customUserData = getCustomUserData(user);
platformEndpointRequest.setCustomUserData(customUserData);
CreatePlatformEndpointResult platformEndpointResult = snsClient.createPlatformEndpoint(platformEndpointRequest);
return platformEndpointResult.getEndpointArn();
}
use of com.amazonaws.services.sns.model.CreatePlatformEndpointResult in project ETSMobile-Android2 by ApplETS.
the class CreateEndpointJob method run.
@Override
public void run() {
verifyPlatformApplication(this.client);
try {
CreatePlatformEndpointResult createResult = client.createPlatformEndpoint(new CreatePlatformEndpointRequest().withPlatformApplicationArn(this.applicationArn).withToken(this.token).withCustomUserData(this.userData));
Log.i("CreateResult", createResult.toString());
} catch (AmazonClientException ace) {
ace.printStackTrace();
}
}
use of com.amazonaws.services.sns.model.CreatePlatformEndpointResult in project ETSMobile-Android2 by ApplETS.
the class ArnEndpointHandler method createEndpoint.
private void createEndpoint() {
try {
SecurePreferences.Editor editor = securePreferences.edit();
CreatePlatformEndpointRequest request = new CreatePlatformEndpointRequest().withPlatformApplicationArn(this.applicationArn).withToken(this.token).withCustomUserData(this.userData);
CreatePlatformEndpointResult createResult = client.createPlatformEndpoint(request);
Log.i("CreateResult", createResult.toString());
editor.putString(Constants.SNS_ARN_ENDPOINT, createResult.getEndpointArn()).apply();
} catch (AmazonClientException ace) {
ace.printStackTrace();
}
}
Aggregations