com.amazonaws.services.sns.model.CreatePlatformEndpointRequest Java Examples

The following examples show how to use com.amazonaws.services.sns.model.CreatePlatformEndpointRequest. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: PlatformApplicationIntegrationTest.java    From aws-sdk-java-resources with Apache License 2.0 6 votes vote down vote up
@Test
@Ignore
public void testActions() throws InterruptedException {

    String topicArn = TopicIntegrationTest.getOrCreateTopic().getArn();

    // setAttributes
    application.setAttributes(new SetPlatformApplicationAttributesRequest()
        .addAttributesEntry("EventEndpointCreated", topicArn)
        .addAttributesEntry("EventEndpointDeleted", topicArn)
        .addAttributesEntry("EventEndpointUpdated", topicArn)
        );
    refreshApplication();
    Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointCreated"));
    Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointDeleted"));
    Assert.assertEquals(topicArn, application.getAttributes().get("EventEndpointUpdated"));


    // createPlatformEndpoint
    application.createPlatformEndpoint(new CreatePlatformEndpointRequest()
        .withToken(GCM_DEVICE_TOKEN)
        .withCustomUserData("My custom user data")
        );

}
 
Example #2
Source File: ArnEndpointHandler.java    From ETSMobile-Android2 with Apache License 2.0 5 votes vote down vote up
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();
    }
}
 
Example #3
Source File: PushSnsService.java    From oxAuth with MIT License 5 votes vote down vote up
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();
}
 
Example #4
Source File: PlatformApplicationImpl.java    From aws-sdk-java-resources with Apache License 2.0 5 votes vote down vote up
@Override
public PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
        request, ResultCapture<CreatePlatformEndpointResult> extractor) {

    ActionResult result = resource.performAction("CreatePlatformEndpoint",
            request, extractor);

    if (result == null) return null;
    return new PlatformEndpointImpl(result.getResource());
}
 
Example #5
Source File: PlatformApplicationImpl.java    From aws-sdk-java-resources with Apache License 2.0 4 votes vote down vote up
@Override
public PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
        request) {

    return createPlatformEndpoint(request, null);
}
 
Example #6
Source File: PlatformApplication.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>CreatePlatformEndpoint</code> action.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>PlatformApplication</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>PlatformApplicationArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The <code>PlatformEndpoint</code> resource object associated with
 *         the result of this action.
 * @see CreatePlatformEndpointRequest
 */
PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
        request);
 
Example #7
Source File: PlatformApplication.java    From aws-sdk-java-resources with Apache License 2.0 2 votes vote down vote up
/**
 * Performs the <code>CreatePlatformEndpoint</code> action and use a
 * ResultCapture to retrieve the low-level client response.
 *
 * <p>
 * The following request parameters will be populated from the data of this
 * <code>PlatformApplication</code> resource, and any conflicting parameter
 * value set in the request will be overridden:
 * <ul>
 *   <li>
 *     <b><code>PlatformApplicationArn</code></b>
 *         - mapped from the <code>Arn</code> identifier.
 *   </li>
 * </ul>
 *
 * <p>
 *
 * @return The <code>PlatformEndpoint</code> resource object associated with
 *         the result of this action.
 * @see CreatePlatformEndpointRequest
 */
PlatformEndpoint createPlatformEndpoint(CreatePlatformEndpointRequest
        request, ResultCapture<CreatePlatformEndpointResult> extractor);