Java
Fetch the Conversation
Inside MainActivity class add the conversation property:
private NexmoConversation conversation;
Update body of the getConversation() method:
private void getConversation() {
client.getConversation(CONVERSATION_ID, new NexmoRequestListener<NexmoConversation>() {
@Override
public void onSuccess(@Nullable NexmoConversation conversation) {
MainActivity.this.conversation = conversation;
}
@Override
public void onError(@NonNull NexmoApiError apiError) {
MainActivity.this.conversation = null;
Toast.makeText(MainActivity.this, "Error: Unable to load conversation", Toast.LENGTH_SHORT);
}
});
}
Please make sure to replace CONVERSATION_ID with the conversation id you created during a previous step.
The above method loads the conversation and stores it in the conversation property.
Note: Conversation id is retrieved from Config.CONVERSATION_ID provided in the previous step.
Creating an Android chat app
Create a Android application that enables users to message each other using the Android Client SDK and Java.
Steps
1
Introduction to this task2
Prerequisites3
Create a Vonage Application4
Create a conversation5
Create the users6
Add users to the conversation7
Generate JWTs8
Create an Android project9
Add permissions10
Build main screen11
Initialize the client12
Fetch the conversation13
Fetch conversation events14
Send a message15
Receive new messages16
What's next?