use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.
the class UserIntentService method onCreate.
@Override
public void onCreate() {
super.onCreate();
messageClientService = new MessageClientService(getApplicationContext());
mobiComConversationService = new MobiComConversationService(getApplicationContext());
}
use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.
the class UserWorker method checkAndSaveLoggedUserDeletedDataToSharedPref.
// Cleanup: private
public void checkAndSaveLoggedUserDeletedDataToSharedPref() {
String userId = MobiComUserPreference.getInstance(getApplicationContext()).getUserId();
if (TextUtils.isEmpty(userId)) {
return;
}
UserDetail[] userDetails = new MessageClientService(getApplicationContext()).getUserDetails(userId);
if (userDetails == null) {
return;
}
for (UserDetail userDetail : userDetails) {
if (userId.equals(userDetail.getUserId()) && userDetail.getDeletedAtTime() != null) {
// this will add a user deleted entry to MobicomUserPreferences
SyncCallService.getInstance(getApplicationContext()).processLoggedUserDelete();
}
}
}
use of com.applozic.mobicomkit.api.conversation.MessageClientService in project Applozic-Android-SDK by AppLozic.
the class MobiComConversationFragment method sendProductMessage.
public void sendProductMessage(final String messageToSend, final FileMeta fileMeta, final Contact contact, final short messageContentType) {
final Message message = new Message();
new Thread(new Runnable() {
@Override
public void run() {
String topicId;
MobiComConversationService conversationService = new MobiComConversationService(getActivity());
MobiComUserPreference userPreferences = MobiComUserPreference.getInstance(getActivity());
topicId = new MessageClientService(getActivity()).getTopicId(currentConversationId);
if (getChannel() != null) {
message.setGroupId(channelKey);
} else {
message.setContactIds(contact.getUserId());
message.setTo(contact.getUserId());
}
message.setMessage(messageToSend);
message.setRead(Boolean.TRUE);
message.setStoreOnDevice(Boolean.TRUE);
message.setSendToDevice(Boolean.FALSE);
message.setContentType(messageContentType);
message.setType(Message.MessageType.MT_OUTBOX.getValue());
message.setDeviceKeyString(userPreferences.getDeviceKeyString());
message.setSource(Message.Source.MT_MOBILE_APP.getValue());
message.setTopicId(messageToSend);
message.setCreatedAtTime(System.currentTimeMillis() + userPreferences.getDeviceTimeOffset());
message.setTopicId(topicId);
message.setConversationId(currentConversationId);
message.setFileMetas(fileMeta);
conversationService.sendMessage(message, userDisplayName);
}
}).start();
}
Aggregations