/** * <p> * Arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in UTF-8 * format and less than 2KB. * </p> * * @param customUserData * Arbitrary user data to associate with the endpoint. Amazon SNS does not use this data. The data must be in * UTF-8 format and less than 2KB. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePlatformEndpointRequest withCustomUserData(String customUserData) { setCustomUserData(customUserData); return this; }
String platformApplicationArn = "arn:aws:sns:us-east-1:897955111111:app/GCM/com.myapp"; AWSCredentials awsCredentials = new BasicAWSCredentials("XXXXXXXX", "XXXXXXXXXXXXXXXXXXXXX"); AmazonSNSClient pushClient = new AmazonSNSClient(awsCredentials); //probably no need for this String customPushData = "my custom data"; CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest(); platformEndpointRequest.setCustomUserData(customPushData); platformEndpointRequest.setToken(pushNotificationRegId); platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn); CreatePlatformEndpointResult result = pushClient.createPlatformEndpoint(platformEndpointRequest);
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(); }
String applicationArn) { CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest(); platformEndpointRequest.setCustomUserData(customData); String token = platformToken; String userId = null;