Skip to content

Sending messages

tjuric edited this page Aug 11, 2016 · 28 revisions

Mobile Messaging library provides an ability to send upstream messages from mobile device, also known as Mobile Originated messages or MO.

###Sending messages with custom data

Use following API to send messages from mobile device:

MoMessage message = new MoMessage();
message.setDestination("destination_identifier");
message.setText("This is my mobile-originated message!");

Map<String, Object> customPayload = new HashMap<>();
customPayload.put("custom_key_1_string", "string_value");
customPayload.put("custom_key_2_number", 1);
customPayload.put("custom_key_3_boolean", true);
message.setCustomPayload(customPayload);

MobileMessaging.getInstance(context).sendMessages(message);

###Receiving sent message status

Register BroadcastReceiver in order to receive status information about each sent message as desribed in MESSAGES_SENT event.

Clone this wiki locally