| CLASS info |
| public abstract class MessageEngine |
| Defines a set of APIs to publish or subscribe to messages between nearby devices. Unless the PendingIntent parameter is passed when #Get is called, all of the APIs need to be used from a foreground activity. You need to symmetrically call put or unput, get or unget, and onStart or onStop. |
| Return | Method |
| void | handleIntent(Intent intent, MessageHandler handler) Extracts information from an intent in subscription callback, and calls the corresponding methods on the specified MessageHandler. Currently, only onFound and onLost are supported. |
| Task<Void> | put(Message message) Publishes a message and broadcasts a sharing code for nearby devices to scan. |
| Task<Void> | put(Message message, PutOption options) Publishes a message and broadcasts a sharing code for nearby devices to scan. |
| Task<Void> | registerStatusCallback(StatusCallback statusCallback) Registers a status callback function, which will notify your app of key events. |
| Task<Void> | get(MessageHandler handler, GetOption options) Subscribes to messages published by a nearby device. |
| Task<Void> | get(MessageHandler handler) Registers the messages to be obtained with the cloud using the default option (DEFAULT). |
| Task<Void> | get(PendingIntent pendingIntent, GetOption options) This method identifies only BLE beacon messages. |
| Task<Void> | get(PendingIntent pendingIntent) This method identifies only BLE beacon messages.It subscribes to messages published by nearby devices in a persistent and low-power manner and uses the default configuration (DEFAULT). |
| Task<Void> | unput(Message message) Cancels message publishing. |
| Task<Void> | unregisterStatusCallback(StatusCallback statusCallback) Cancels the status callback registered before. |
| Task<Void> | unget(MessageHandler handler) Cancels a message subscription. |
| Task<Void> | unget(PendingIntent pendingIntent) Cancels a message subscription. |
| Method |
| public abstract void handleIntent(Intent intent, MessageHandler handler) |
| Extracts information from an intent in subscription callback, and calls the corresponding methods on the specified MessageHandler. Currently, only onFound and onLost are supported. |
Parameters
| Parameter name | Parameter desc |
| intent | Intent content. |
| handler | Message callback processing. |
| Method |
| public abstract Task<Void> put (Message message) |
| Publishes a message and broadcasts a token for nearby devices to scan. |
Parameters
| Parameter name | Parameter desc |
| message | Published message. |
| Method |
| public abstract Task<Void> put(Message message, PutOption options) |
| Publishes a message and broadcasts a token for nearby devices to scan. This message is published only to apps that use the same project ID and have registered the message type with the cloud for subscription. |
Parameters
| Parameter name | Parameter desc |
| message | Published message. |
| options | PutOption parameters. |
| Method |
| public abstract Task<Void> registerStatusCallback(StatusCallback statusCallback) |
| Registers a status callback function, which will notify your app of key events. When your app calls one of the APIs for the first time, the function will return the status. |
Parameters
| Parameter name | Parameter desc |
| statusCallback | statusCallback function. |
| Method |
| public abstract Task<Void> get(MessageHandler handler, GetOption options) |
| Registers the messages to be obtained with the cloud. Only messages with the same project ID can be obtained. |
Parameters
| Parameter name | Parameter desc |
| handler | MessageHandler implementation to obtain callbacks of received messages. |
| options | GetOption parameters. |
| Method |
| public abstract Task<Void> get(MessageHandler handler) |
| Registers the messages to be obtained with the cloud using the default option (DEFAULT). |
Parameters
| Parameter name | Parameter desc |
| handler | MessageHandler implementation to obtain callbacks of received messages. |
| Method |
| public abstract Task<Void> get(PendingIntent pendingIntent, GetOption options) |
| This method identifies only BLE beacon messages. |
Parameters
| Parameter name | Parameter desc |
| pendingIntent | pendingIntent to obtain callbacks of nearby messages |
| options | GetOption parameters. |
| Method |
| public abstract Task<Void> get(PendingIntent pendingIntent) |
| This method identifies only BLE beacon messages. It subscribes to messages published by nearby devices in a persistent and low-power manner and uses the default configuration (DEFAULT). |
Parameters
| Parameter name | Parameter desc |
| pendingIntent | pendingIntent to obtain callbacks of nearby messages |
| Method |
| public abstract Task<Void> unput(Message message) |
| Cancels message publishing. |
Parameters
| Parameter name | Parameter desc |
| message | Published message. |
| Method |
| public abstract Task<Void> unregisterStatusCallback(StatusCallback statusCallback) |
| Cancels the status callback registered before. |
Parameters
| Parameter name | Parameter desc |
| statusCallback | Status callback registered before. |
| Method |
| public abstract Task<Void> unget(MessageHandler handler) |
| Cancels a message subscription. |
Parameters
| Parameter name | Parameter desc |
| handler | Message handler registered before. |
| Method |
| public abstract Task<Void> unget(PendingIntent pendingIntent) |
| Cancels a message subscription. |
Parameters
| Parameter name | Parameter desc |
| pendingIntent | Pending intent registered before. |