public class GcmXmppClient extends Object
| Modifier and Type | Field and Description |
|---|---|
protected boolean |
connectionDraining
Indicates whether the connection is in draining state, which means that it
will not accept any new downstream messages.
|
static String |
GCM_ELEMENT_NAME |
static String |
GCM_NAMESPACE |
static String |
GCM_PROD_HOST |
static int |
GCM_PROD_PORT |
| Constructor and Description |
|---|
GcmXmppClient(String host,
int port,
String senderId,
String apiKey) |
GcmXmppClient(String user,
String password) |
| Modifier and Type | Method and Description |
|---|---|
void |
connect() |
static String |
createJsonMessage(String to,
String messageId,
Map<String,String> payload,
String collapseKey,
Long timeToLive,
Boolean delayWhileIdle)
Creates a JSON encoded GCM message.
|
String |
generateMessageId()
Returns a random message id to uniquely identify a message.
|
protected void |
send(String jsonRequest)
Sends a packet with contents provided.
|
void |
sendDownstreamMessage(String message,
String registrationId) |
public static final String GCM_ELEMENT_NAME
public static final String GCM_NAMESPACE
public static final String GCM_PROD_HOST
public static final int GCM_PROD_PORT
protected volatile boolean connectionDraining
public void connect()
public String generateMessageId()
protected void send(String jsonRequest) throws org.jivesoftware.smack.SmackException.NotConnectedException
jsonRequest - JSONPayloadorg.jivesoftware.smack.SmackException.NotConnectedException - Exceptionpublic static String createJsonMessage(String to, String messageId, Map<String,String> payload, String collapseKey, Long timeToLive, Boolean delayWhileIdle)
to - RegistrationId of the target device (Required).messageId - Unique messageId for which CCS sends an "ack/nack" (Required).payload - ServerMessage content intended for the application. (Optional).collapseKey - GCM collapse_key parameter (Optional).timeToLive - GCM time_to_live parameter (Optional).delayWhileIdle - GCM delay_while_idle parameter (Optional).Copyright © 2016 Pivotal Software, Inc.. All rights reserved.