use of com.applozic.mobicomkit.uiwidgets.async.ApplozicConversationCreateTask in project Applozic-Android-SDK by AppLozic.
the class MainActivity method takeOrder.
// public void takeOrder(View v) {
// Intent takeOrderIntent = new Intent(this, ConversationActivity.class);
// takeOrderIntent.putExtra(TAKE_ORDER, true);
// takeOrderIntent.putExtra(ConversationUIService.USER_ID, Utils.getMetaDataValue(this, TAKE_ORDER_USERID_METADATA));
// takeOrderIntent.putExtra(ConversationUIService.DEFAULT_TEXT, "Hello I am interested in your property, Can we chat?");
// takeOrderIntent.putExtra(ConversationUIService.PRODUCT_TOPIC_ID, "Ebco Strip Light Connection Cord 4");
// takeOrderIntent.putExtra(ConversationUIService.PRODUCT_IMAGE_URL, "https://www.applozic.com/resources/sidebox/images/applozic.png");
// // takeOrderIntent.putExtra(ConversationUIService.APPLICATION_ID,"applozic-sample-app");
// startActivity(takeOrderIntent);
// }
public void takeOrder(View v) {
Conversation conversation = buildConversation();
ApplozicConversationCreateTask applozicConversationCreateTask;
ApplozicConversationCreateTask.ConversationCreateListener conversationCreateListener = new ApplozicConversationCreateTask.ConversationCreateListener() {
@Override
public void onSuccess(Integer conversationId, Context context) {
Log.i(TAG, "ConversationID is:" + conversationId);
Intent takeOrderIntent = new Intent(context, ConversationActivity.class);
takeOrderIntent.putExtra(TAKE_ORDER, true);
takeOrderIntent.putExtra(ConversationUIService.CONTEXT_BASED_CHAT, true);
takeOrderIntent.putExtra(ConversationUIService.USER_ID, "usertest2");
takeOrderIntent.putExtra(ConversationUIService.DEFAULT_TEXT, R.string.intrest_in_chat);
takeOrderIntent.putExtra(ConversationUIService.CONVERSATION_ID, conversationId);
startActivity(takeOrderIntent);
}
@Override
public void onFailure(Exception e, Context context) {
}
};
applozicConversationCreateTask = new ApplozicConversationCreateTask(MainActivity.this, conversationCreateListener, conversation);
applozicConversationCreateTask.execute((Void) null);
}
Aggregations