@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPlatformApplicationArn() == null) ? 0 : getPlatformApplicationArn().hashCode()); hashCode = prime * hashCode + ((getToken() == null) ? 0 : getToken().hashCode()); hashCode = prime * hashCode + ((getCustomUserData() == null) ? 0 : getCustomUserData().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
/** * <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; }
/** * <p> * PlatformApplicationArn returned from CreatePlatformApplication is used to create a an endpoint. * </p> * * @param platformApplicationArn * PlatformApplicationArn returned from CreatePlatformApplication is used to create a an endpoint. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePlatformEndpointRequest withPlatformApplicationArn(String platformApplicationArn) { setPlatformApplicationArn(platformApplicationArn); 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);
/** * <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; }
/** * <p> * For a list of attributes, see <a * href="http://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>. * </p> * * @param attributes * For a list of attributes, see <a * href="http://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>. * @return Returns a reference to this object so that method calls can be chained together. */ public CreatePlatformEndpointRequest withAttributes(java.util.Map<String, String> attributes) { setAttributes(attributes); return this; }
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(); }
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; }
@Override public boolean equals(Object obj) { if (this == obj) return true; if (obj == null) return false; if (obj instanceof CreatePlatformEndpointRequest == false) return false; CreatePlatformEndpointRequest other = (CreatePlatformEndpointRequest) obj; if (other.getPlatformApplicationArn() == null ^ this.getPlatformApplicationArn() == null) return false; if (other.getPlatformApplicationArn() != null && other.getPlatformApplicationArn().equals(this.getPlatformApplicationArn()) == false) return false; if (other.getToken() == null ^ this.getToken() == null) return false; if (other.getToken() != null && other.getToken().equals(this.getToken()) == false) return false; if (other.getCustomUserData() == null ^ this.getCustomUserData() == null) return false; if (other.getCustomUserData() != null && other.getCustomUserData().equals(this.getCustomUserData()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true; }
Platform platform, String customData, String platformToken, String applicationArn) { CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest(); platformEndpointRequest.setCustomUserData(customData); String token = platformToken; String userId = null; endpointAttributes.put("UserId", userId); endpointAttributes.put("ChannelId", token); platformEndpointRequest.setAttributes(endpointAttributes); platformEndpointRequest.setToken(token); platformEndpointRequest.setPlatformApplicationArn(applicationArn); return snsClient.createPlatformEndpoint(platformEndpointRequest);
CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest(); platformEndpointRequest.setToken(token()); platformEndpointRequest.setPlatformApplicationArn(PLATFORM_APPLICATION_ARN); CreatePlatformEndpointResult result = mClient.createPlatformEndpoint(platformEndpointRequest); mNotifPreferencesHelper.storeEndpointArn(result.getEndpointArn());
/** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. * * @return A string representation of this object. * * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPlatformApplicationArn() != null) sb.append("PlatformApplicationArn: ").append(getPlatformApplicationArn()).append(","); if (getToken() != null) sb.append("Token: ").append(getToken()).append(","); if (getCustomUserData() != null) sb.append("CustomUserData: ").append(getCustomUserData()).append(","); if (getAttributes() != null) sb.append("Attributes: ").append(getAttributes()); sb.append("}"); return sb.toString(); }
public Request<CreatePlatformEndpointRequest> marshall(CreatePlatformEndpointRequest createPlatformEndpointRequest) { if (createPlatformEndpointRequest == null) { throw new SdkClientException("Invalid argument passed to marshall(...)"); } Request<CreatePlatformEndpointRequest> request = new DefaultRequest<CreatePlatformEndpointRequest>(createPlatformEndpointRequest, "AmazonSNS"); request.addParameter("Action", "CreatePlatformEndpoint"); request.addParameter("Version", "2010-03-31"); request.setHttpMethod(HttpMethodName.POST); if (createPlatformEndpointRequest.getPlatformApplicationArn() != null) { request.addParameter("PlatformApplicationArn", StringUtils.fromString(createPlatformEndpointRequest.getPlatformApplicationArn())); } if (createPlatformEndpointRequest.getToken() != null) { request.addParameter("Token", StringUtils.fromString(createPlatformEndpointRequest.getToken())); } if (createPlatformEndpointRequest.getCustomUserData() != null) { request.addParameter("CustomUserData", StringUtils.fromString(createPlatformEndpointRequest.getCustomUserData())); } java.util.Map<String, String> attributes = createPlatformEndpointRequest.getAttributes(); int attributesListIndex = 1; for (Map.Entry<String, String> entry : attributes.entrySet()) { if (entry.getKey() != null) { request.addParameter("Attributes.entry." + attributesListIndex + ".key", StringUtils.fromString(entry.getKey())); } if (entry.getValue() != null) { request.addParameter("Attributes.entry." + attributesListIndex + ".value", StringUtils.fromString(entry.getValue())); } attributesListIndex++; } return request; }
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPlatformApplicationArn() == null) ? 0 : getPlatformApplicationArn() .hashCode()); hashCode = prime * hashCode + ((getToken() == null) ? 0 : getToken().hashCode()); hashCode = prime * hashCode + ((getCustomUserData() == null) ? 0 : getCustomUserData().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
CreatePlatformEndpointRequest other = (CreatePlatformEndpointRequest) obj; if (other.getPlatformApplicationArn() == null ^ this.getPlatformApplicationArn() == null) return false; if (other.getPlatformApplicationArn() != null && other.getPlatformApplicationArn().equals(this.getPlatformApplicationArn()) == false) return false; if (other.getToken() == null ^ this.getToken() == null) return false; if (other.getToken() != null && other.getToken().equals(this.getToken()) == false) return false; if (other.getCustomUserData() == null ^ this.getCustomUserData() == null) return false; if (other.getCustomUserData() != null && other.getCustomUserData().equals(this.getCustomUserData()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true;
/** * Returns a string representation of this object; useful for testing and * debugging. * * @return A string representation of this object. * @see java.lang.Object#toString() */ @Override public String toString() { StringBuilder sb = new StringBuilder(); sb.append("{"); if (getPlatformApplicationArn() != null) sb.append("PlatformApplicationArn: " + getPlatformApplicationArn() + ","); if (getToken() != null) sb.append("Token: " + getToken() + ","); if (getCustomUserData() != null) sb.append("CustomUserData: " + getCustomUserData() + ","); if (getAttributes() != null) sb.append("Attributes: " + getAttributes()); sb.append("}"); return sb.toString(); }
if (createPlatformEndpointRequest.getPlatformApplicationArn() != null) { prefix = "PlatformApplicationArn"; String platformApplicationArn = createPlatformEndpointRequest .getPlatformApplicationArn(); request.addParameter(prefix, StringUtils.fromString(platformApplicationArn)); if (createPlatformEndpointRequest.getToken() != null) { prefix = "Token"; String token = createPlatformEndpointRequest.getToken(); request.addParameter(prefix, StringUtils.fromString(token)); if (createPlatformEndpointRequest.getCustomUserData() != null) { prefix = "CustomUserData"; String customUserData = createPlatformEndpointRequest.getCustomUserData(); request.addParameter(prefix, StringUtils.fromString(customUserData)); if (createPlatformEndpointRequest.getAttributes() != null) { prefix = "Attributes"; java.util.Map<String, String> attributes = createPlatformEndpointRequest .getAttributes(); int attributesIndex = 1; String attributesPrefix = prefix + ".entry.";
@Override public int hashCode() { final int prime = 31; int hashCode = 1; hashCode = prime * hashCode + ((getPlatformApplicationArn() == null) ? 0 : getPlatformApplicationArn() .hashCode()); hashCode = prime * hashCode + ((getToken() == null) ? 0 : getToken().hashCode()); hashCode = prime * hashCode + ((getCustomUserData() == null) ? 0 : getCustomUserData().hashCode()); hashCode = prime * hashCode + ((getAttributes() == null) ? 0 : getAttributes().hashCode()); return hashCode; }
CreatePlatformEndpointRequest other = (CreatePlatformEndpointRequest) obj; if (other.getPlatformApplicationArn() == null ^ this.getPlatformApplicationArn() == null) return false; if (other.getPlatformApplicationArn() != null && other.getPlatformApplicationArn().equals(this.getPlatformApplicationArn()) == false) return false; if (other.getToken() == null ^ this.getToken() == null) return false; if (other.getToken() != null && other.getToken().equals(this.getToken()) == false) return false; if (other.getCustomUserData() == null ^ this.getCustomUserData() == null) return false; if (other.getCustomUserData() != null && other.getCustomUserData().equals(this.getCustomUserData()) == false) return false; if (other.getAttributes() == null ^ this.getAttributes() == null) return false; if (other.getAttributes() != null && other.getAttributes().equals(this.getAttributes()) == false) return false; return true;