1 private static class TestCallMessageObserver implements Call.CallMessageListener {
3 public void onMessageReceived(CallMessage callMesssage) {
4 Log.d("[test]", "Call Message received");
7 public void onMessageSent(String voiceEventSID) {
8 Log.d("[test]", "Call Message:" + voiceEventSID + " sent");
11 public void onMessageFailure(String voiceEventSID, VoiceException error) {
12 Log.d("[test]", "Call Message: " + voiceEventSID + " failed to send: " + error.getMessage());
18 // register notification callbacks upon connect
19 ConnectOptions cxnOptions = new ConnectOptions.Builder(accessToken))
20 .callMessageListener(new TestCallMessageObserver())
22 Call call = Voice.connect(context, connectOptions, new Call.Listener() {...});
27 final CallMessage callMessage = (
28 new CallMessage.Builder(CallMessage.MessageType.UserDefinedMessage))
29 .contentType("application/json")
30 .content((new JSONObject())
34 call.sendMessage(callMessage);
38 // receive call message before accpeting invite
39 Voice.handleMessage(this, data, new TestCallMessageObserver());