Example usage for com.amazonaws.services.sns.model CreatePlatformEndpointRequest setAttributes

List of usage examples for com.amazonaws.services.sns.model CreatePlatformEndpointRequest setAttributes

Introduction

In this page you can find the example usage for com.amazonaws.services.sns.model CreatePlatformEndpointRequest setAttributes.

Prototype


public void setAttributes(java.util.Map<String, String> attributes) 

Source Link

Document

<p> For a list of attributes, see <a href="https://docs.aws.amazon.com/sns/latest/api/API_SetEndpointAttributes.html">SetEndpointAttributes</a>.

Usage

From source file:AmazonSNSClientWrapper.java

License:Open Source License

private CreatePlatformEndpointResult createPlatformEndpoint(SampleMessageGenerator.Platform platform,
        String customData, String platformToken, String applicationArn) {
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    String token = platformToken;
    String userId = null;//from ww  w.jav a2s.  c o m
    if (platform == SampleMessageGenerator.Platform.BAIDU) {
        String[] tokenBits = platformToken.split("\\|");
        token = tokenBits[0];
        userId = tokenBits[1];
        Map<String, String> endpointAttributes = new HashMap<String, String>();
        endpointAttributes.put("UserId", userId);
        endpointAttributes.put("ChannelId", token);
        platformEndpointRequest.setAttributes(endpointAttributes);
    }
    platformEndpointRequest.setToken(token);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);
}

From source file:com.aws.sns.service.notifications.sns.AmazonSNSClientWrapper.java

License:Open Source License

private CreatePlatformEndpointResult createPlatformEndpoint(Platform platform, String customData,
        String platformToken, String applicationArn) {
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    String token = platformToken;
    String userId = null;//from  www.  ja  va  2 s.  com
    if (platform == Platform.BAIDU) {
        String[] tokenBits = platformToken.split("\\|");
        token = tokenBits[0];
        userId = tokenBits[1];
        Map<String, String> endpointAttributes = new HashMap<String, String>();
        endpointAttributes.put("UserId", userId);
        endpointAttributes.put("ChannelId", token);
        platformEndpointRequest.setAttributes(endpointAttributes);
    }
    platformEndpointRequest.setToken(token);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);
}

From source file:com.dev.appx.sns.tools.AmazonSNSClientWrapper.java

License:Open Source License

public CreatePlatformEndpointResult createPlatformEndpoint(Platform platform, String customData,
        String platformToken, String applicationArn) {
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    String token = platformToken;
    String userId = null;//  w w  w.j a  va2  s .  c  o m
    if (platform == Platform.BAIDU) {
        String[] tokenBits = platformToken.split("\\|");
        token = tokenBits[0];
        userId = tokenBits[1];
        Map<String, String> endpointAttributes = new HashMap<String, String>();
        endpointAttributes.put("UserId", userId);
        endpointAttributes.put("ChannelId", token);
        platformEndpointRequest.setAttributes(endpointAttributes);
    }
    platformEndpointRequest.setToken(token);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);
}

From source file:com.screensaver.util.AmazonSNSClientWrapper.java

License:Open Source License

private CreatePlatformEndpointResult createPlatformEndpoint(Platform platform, String customData,
        String platformToken, String applicationArn) {
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    String token = platformToken;
    String userId = null;//from  w ww .j  a  v  a 2  s .  c o  m
    if (platform == SampleMessageGenerator.Platform.BAIDU) {
        String[] tokenBits = platformToken.split("\\|");
        token = tokenBits[0];
        userId = tokenBits[1];
        Map<String, String> endpointAttributes = new HashMap<String, String>();
        endpointAttributes.put("UserId", userId);
        endpointAttributes.put("ChannelId", token);
        platformEndpointRequest.setAttributes(endpointAttributes);
    }
    platformEndpointRequest.setToken(token);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);

}