use of com.applozic.mobicomkit.api.conversation.Message in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method sendVideoCallAnswer.
public void sendVideoCallAnswer(Contact contact, String videoCallId) {
Log.i(TAG, "sendVideoCallAnswer()");
this.videoCallId = videoCallId;
Message notificationMessage = getNotificationMessage(contact);
notificationMessage.setMessage(videoCallId);
notificationMessage.setMetadata(getAnswerCallMetaData());
conversationService.sendMessage(notificationMessage, MessageIntentService.class);
Log.i(TAG, "sendVideoCallAnswer() END");
}
use of com.applozic.mobicomkit.api.conversation.Message in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method buildVideoCallNotification.
public static void buildVideoCallNotification(Context context, Message message) {
Map<String, String> metaDataMap = message.getMetadata();
Contact contact = new AppContactService(context).getContactById(message.getContactIds());
String audioORVideoCallPrefix = Boolean.valueOf(metaDataMap.get(CALL_AUDIO_ONLY)) ? "audio call " : "video call ";
if (metaDataMap.get(VideoCallNotificationHelper.MSG_TYPE).equals(VideoCallNotificationHelper.CALL_MISSED)) {
Message message1 = new Message(message);
message1.setMessage("You missed " + audioORVideoCallPrefix + " from " + contact.getDisplayName());
BroadcastService.sendNotificationBroadcast(context, message1);
}
}
use of com.applozic.mobicomkit.api.conversation.Message in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method sendVideoCallReject.
// public void sendVideoCallCanceled(Contact contact, String videoCallId) {
//
// Message statusMessage = getVideoCallStatusMessage(contact);
// statusMessage.setMetadata(getVideoCanceledMap());
// statusMessage.setMessage(videoCallId);
// conversationService.sendMessage(statusMessage, MessageIntentService.class);
//
// }
// public void sendVideoCallCanceledNotification(Contact contact, String videoCallId) {
//
// Message statusMessage = getNotificationMessage(contact);
// statusMessage.setMetadata(getVideoCanceledMap());
// statusMessage.setMessage(videoCallId);
// conversationService.sendMessage(statusMessage, MessageIntentService.class);
//
// }
public void sendVideoCallReject(Contact contact, String videoCallId) {
this.videoCallId = videoCallId;
Message notificationMessage = getNotificationMessage(contact);
notificationMessage.setMetadata(getRejectedCallMap());
notificationMessage.setMessage(videoCallId);
conversationService.sendMessage(notificationMessage, MessageIntentService.class);
}
use of com.applozic.mobicomkit.api.conversation.Message in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method handleVideoCallNotificationMessages.
public void handleVideoCallNotificationMessages(final Message message) {
Map<String, String> valueMap = message.getMetadata();
String type = valueMap.get(MSG_TYPE);
videoCallId = valueMap.get(CALL_ID);
if (TextUtils.isEmpty(type)) {
return;
}
if (type.equals(CALL_DIALED)) {
handleIncomingVideoNotification(message);
} else if (type.equals(CALL_ANSWERED)) {
Intent intent = new Intent(MobiComKitConstants.APPLOZIC_VIDEO_CALL_ANSWER);
intent.putExtra(CALL_ID, videoCallId);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} else if (type.equals(CALL_REJECTED)) {
Intent intent = new Intent(MobiComKitConstants.APPLOZIC_VIDEO_CALL_REJECTED);
intent.putExtra(CALL_ID, videoCallId);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
if (!message.isTypeOutbox() && BroadcastService.videoCallAcitivityOpend) {
Contact contact = baseContactService.getContactById(message.getContactIds());
Message statusMessage = getVideoCallStatusMessage(contact);
statusMessage.setMessage("Call Busy");
statusMessage.setMetadata(getRejectedCallMap());
conversationService.sendMessage(statusMessage, MessageIntentService.class);
}
} else if (type.equals(CALL_MISSED)) {
Intent intent = new Intent(CALL_MISSED);
intent.putExtra(CALL_ID, videoCallId);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} else if (type.equals(CALL_CANCELED)) {
Intent intent = new Intent(CALL_CANCELED);
intent.putExtra(CALL_ID, videoCallId);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
} else if (type.equals(CALL_END)) {
Intent intent = new Intent(CALL_END);
intent.putExtra(CALL_ID, videoCallId);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);
}
}
use of com.applozic.mobicomkit.api.conversation.Message in project Applozic-Android-SDK by AppLozic.
the class VideoCallNotificationHelper method getNotificationMessage.
@NonNull
private Message getNotificationMessage(Contact contact) {
Message notificationMessage = new Message();
MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(context);
notificationMessage.setContactIds(contact.getContactIds());
notificationMessage.setTo(contact.getContactIds());
notificationMessage.setCreatedAtTime(System.currentTimeMillis());
notificationMessage.setStoreOnDevice(Boolean.TRUE);
notificationMessage.setSendToDevice(Boolean.TRUE);
notificationMessage.setContentType(Message.ContentType.VIDEO_CALL_NOTIFICATION_MSG.getValue());
notificationMessage.setDeviceKeyString(userPreferences.getDeviceKeyString());
notificationMessage.setMessage(videoCallId);
return notificationMessage;
}
Aggregations