/** * <p> * Unique identifier created by the notification service for an app on a device. The specific name for Token will * vary, depending on which notification service is being used. For example, when using APNS as the notification * service, you need the device token. Alternatively, when using GCM or ADM, the device token equivalent is called * the registration ID. * </p> * * @param token * Unique identifier created by the notification service for an app on a device. The specific name for Token * will vary, depending on which notification service is being used. For example, when using APNS as the * notification service, you need the device token. Alternatively, when using GCM or ADM, the device token * equivalent is called the registration ID. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePlatformEndpointRequest withToken(String token) { setToken(token); 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);
final CreatePlatformEndpointRequest request = new CreatePlatformEndpointRequest(); request.setPlatformApplicationArn(platformApplicationArn); request.setToken(gcmToken); final CreatePlatformEndpointResult result = snsClient.createPlatformEndpoint(request);
new AsyncTask<Void, Void, Void>(){ @Override protected Void doInBackground(Void... params) { AWSCredentials awsCredentials = new BasicAWSCredentials("access Key", "secret Key"); AmazonSNSClient pushClient = new AmazonSNSClient(awsCredentials); CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest(); platformEndpointRequest.setToken(regToken); platformEndpointRequest.setPlatformApplicationArn(platformApplicationArn); pushClient.setRegion(Region.getRegion(Regions.Region_Name)); CreatePlatformEndpointResult result = pushClient.createPlatformEndpoint(platformEndpointRequest); Log.e("Registration result",result.toString()); return null; }
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(); }
platformEndpointRequest.setAttributes(endpointAttributes); platformEndpointRequest.setToken(token); platformEndpointRequest.setPlatformApplicationArn(applicationArn); return snsClient.createPlatformEndpoint(platformEndpointRequest);
platformEndpointRequest.setToken(token()); platformEndpointRequest.setPlatformApplicationArn(PLATFORM_APPLICATION_ARN); CreatePlatformEndpointResult result = mClient.createPlatformEndpoint(platformEndpointRequest);