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

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

Introduction

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

Prototype


public void setToken(String token) 

Source Link

Document

Unique identifier created by the notification service for an app on a device.

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   w w  w . 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);
}

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  w w w.  j a  v a 2s. 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.cloudbees.gasp.services.SNSMobile.java

License:Open Source License

public CreatePlatformEndpointResult createPlatformEndpoint(String customData, String platformToken,
        String applicationArn) {/*  w  w  w . j  a  va2s .c  o m*/
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    platformEndpointRequest.setToken(platformToken);
    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;//from  w  w  w.j  av a  2s .  co  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.easarrive.aws.plugins.common.service.impl.SNSService.java

License:Open Source License

/**
 * {@inheritDoc}/*from  ww w .  j av a2  s .c o m*/
 */
@Override
public CreatePlatformEndpointResult createPlatformEndpoint(AmazonSNS client,
        SNSPlatformEndpointRequest platformEndpointRequest) {
    if (platformEndpointRequest == null) {
        return null;
    }
    CreatePlatformEndpointRequest createPlatformEndpointRequest = new CreatePlatformEndpointRequest();
    createPlatformEndpointRequest.setCustomUserData(platformEndpointRequest.getCustomUserData());
    createPlatformEndpointRequest
            .setPlatformApplicationArn(platformEndpointRequest.getPlatformApplicationArn());
    createPlatformEndpointRequest.setToken(platformEndpointRequest.getToken());
    createPlatformEndpointRequest.withAttributes(platformEndpointRequest.getAttributes());

    CreatePlatformEndpointResult result = client.createPlatformEndpoint(createPlatformEndpointRequest);
    return result;
}

From source file:com.mistminds.service.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;
    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  w  w .  j  av  a  2 s  . co 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:edu.utn.frba.grupo5303.serverenviolibre.services.NotificacionesPushService.java

private CreatePlatformEndpointResult createPlatformEndpoint(String customData, String gcmIdDestino,
        String applicationArn) {//from  ww  w  .java  2s .  c  o m
    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    String token = gcmIdDestino;
    platformEndpointRequest.setToken(token);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);
}

From source file:tools.AmazonSNSClientWrapper.java

License:Open Source License

private CreatePlatformEndpointResult createPlatformEndpoint(Platform platform, String customData,
        String platformToken, String applicationArn) {

    CreatePlatformEndpointRequest platformEndpointRequest = new CreatePlatformEndpointRequest();
    platformEndpointRequest.setCustomUserData(customData);
    platformEndpointRequest.setToken(platformToken);
    platformEndpointRequest.setPlatformApplicationArn(applicationArn);
    return snsClient.createPlatformEndpoint(platformEndpointRequest);
}