public class MessagingClient extends Endpoint
Modifier and Type | Class and Description |
---|---|
private static class |
MessagingClient.MessagingAsyncTask
AsyncTask to call GAE Messaging Endpoint
|
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
DEVICE_ADDED |
private java.lang.String |
DEVICE_REMOVED |
private java.lang.String |
ERROR_SEND
Send error message
|
private java.lang.String |
PING |
private java.lang.String |
PING_RESPONSE |
private static MessagingClient |
sInstance |
private java.lang.String |
TAG |
ERROR_CREDENTIAL, ERROR_UNKNOWN, mContext
Modifier | Constructor and Description |
---|---|
private |
MessagingClient(android.content.Context context) |
Modifier and Type | Method and Description |
---|---|
private org.json.JSONObject |
getJSONData(java.lang.String action,
java.lang.String message)
Build the message data object
|
private com.weebly.opus1269.clipman.backend.messaging.Messaging |
getMessagingService(com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential)
Get an authorized connection to the MessagingEndpoint
|
static MessagingClient |
INST(android.content.Context context)
Lazily create our instance
|
void |
send(Clip clip)
Send contents of
Clip |
(package private) void |
sendDeviceAdded()
Notify of our addition
|
void |
sendDeviceRemoved()
Notify of our removal
|
private com.weebly.opus1269.clipman.backend.messaging.model.EndpointRet |
sendMessage(org.json.JSONObject data)
Send a message - Blocks
|
void |
sendPing()
Ping others
|
void |
sendPingResponse(java.lang.String srcRegId)
Respond to ping
|
getAndroidJsonFactory, getCredential, getNetHttpTransport, getRegToken, notSignedIn, setHttpTimeout, setLocalServer
private static MessagingClient sInstance
private final java.lang.String TAG
private final java.lang.String PING
private final java.lang.String PING_RESPONSE
private final java.lang.String DEVICE_ADDED
private final java.lang.String DEVICE_REMOVED
private final java.lang.String ERROR_SEND
private MessagingClient(@NonNull android.content.Context context)
public static MessagingClient INST(@NonNull android.content.Context context)
context
- any old contextvoid sendDeviceAdded()
public void sendDeviceRemoved()
public void sendPing()
public void sendPingResponse(java.lang.String srcRegId)
srcRegId
- source of pingprivate com.weebly.opus1269.clipman.backend.messaging.Messaging getMessagingService(com.google.api.client.googleapis.auth.oauth2.GoogleCredential credential)
credential
- - authorization for current user@Nullable private org.json.JSONObject getJSONData(java.lang.String action, java.lang.String message)
action
- the message actionmessage
- the message textprivate com.weebly.opus1269.clipman.backend.messaging.model.EndpointRet sendMessage(org.json.JSONObject data)
data
- Message payload