Git Product home page Git Product logo

conversations-quickstart-android's Introduction

Conversations Quickstart App for Android

This is a lightweight Android application for Twilio Conversations.

Configuring and getting started

This demo requires a Twilio account and a working Conversations Service SID. Here is what is needed:

  • Your Account's Conversation Service Sid ISXXX SID which is attached to your Conversation Service. You can find that information in the Twilio Console. You can also create a service there if you don't already have one.

Replacing the Access Token

In order for your quickstart application to work, we need to authenticate an end user by retrieving a short-lived access token attached to your API Key. The strings.xml resource has a placeholder for your access token named test_access_token.

You can generate a token in a few ways:

For the twilio-cli option, run the following command and enter the resulting token into the placeholder:

twilio token:chat --identity <The test username> --chat-service-sid <ISXXX...>

Note: You need to generate an access token with a ChatGrant for a Conversations user to use the Twilio Conversations Client SDK.

After generating a token manually, it will expire after a timeout period, so you will need to replace the token. To use this in production software, you would typically create a token endpoint in your back end application that uses your existing user authentication strategy.

conversations-quickstart-android's People

Contributors

jefflinwood avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

conversations-quickstart-android's Issues

Error retrieving conversation: Channel not found

I Create a User with the name "A" and Create a Conversation with the Name "C_Conversation". And send 4 or 5 msg on that conversation and it shows me on the screen. Then After I Relaunch my App with the Same username and the conversation name and I found it create a new same name conversation. So I'm not get already exist user of that conversation.
Whenever I load the conversation its goes inside Error on the below method.

private void loadChannels() {
if (conversationsClient == null || conversationsClient.getMyConversations() == null) {
return;
}
conversationsClient.getConversation(DEFAULT_CONVERSATION_NAME, new CallbackListener() {
@OverRide
public void onSuccess(Conversation conversation) {
if (conversation != null) {
if (conversation.getStatus() == Conversation.ConversationStatus.JOINED
|| conversation.getStatus() == Conversation.ConversationStatus.NOT_PARTICIPATING) {
Log.d(MainActivity.TAG, "Already Exists in Conversation: " + DEFAULT_CONVERSATION_NAME);
QuickstartConversationsManager.this.conversation = conversation;
QuickstartConversationsManager.this.conversation.addListener(mDefaultConversationListener);
QuickstartConversationsManager.this.loadPreviousMessages(conversation);
} else {
Log.d(MainActivity.TAG, "Joining Conversation: " + DEFAULT_CONVERSATION_NAME);
joinConversation(conversation);
}
}
}

        @Override
        public void onError(ErrorInfo errorInfo) {
            Log.e(MainActivity.TAG, "Error retrieving conversation: " + errorInfo.getMessage());
            createConversation();
        }

    });
}

Its Always go inside the error method and the error is channel not found. In IOS SDK it is Working fine with the same credentials.

Command timeout reached

twilio: Error creating Twilio Conversations Client: Command timeout reached

Receiving this error while creating the ConversationClient in android application. Using the same code which is mentioned on the official Twilio page. Please help to resolve this error. I tried many times but the issue is still there.

2 Users unable to join the same channel.

I tried running 2 instances of the quickstart with 2 separate identities and having them join the same channel. It seems that this may not be an intended use case because it seems you cannot actually join a conversation before being added into it. However it may not be obvious to users of the quickstart that you have to add both participants to the same conversation outside of the quickstart.

Loom here of the issue:
https://www.loom.com/share/63f4aef1fd2345f9a3b2112354deee0d

Loom of adding the users manually to the same conversation to fix it:
https://www.loom.com/share/0dc49f21730b497389baa730c820b11b

Relevant code block:
https://github.com/TwilioDevEd/conversations-quickstart-android/blob/main/app/src/main/java/com/twilio/conversationsquickstart/QuickstartConversationsManager.java#L146-L167

setLastReadMessageIndex for first time

For the first time, that conversation was created and it still has no message, What number should be set for the last read message index? if set -1 after getting the first message, getUnreadMessagesCount return null if set 0 after getting the first message, getUnreadMessagesCount return 0

Cannot send message

Issue:
Cannot send a message

Steps Taken:
-Build Project on Android Studio 4.1
-Generate Access Token in Twilio CLI
-Input access token in strings.xml
-Run on Android Simulator
-Try to send message

Error Messages Seen:
2021-02-17 00:39:25.238 11613-11613/? E/tionsquickstar: Unknown bits set in runtime_flags: 0x8000
2021-02-17 00:40:56.297 11613-11613/com.twilio.conversationsquickstart E/TwilioConversations: Error creating Twilio Conversations Client: Command timeout reached

Error Creating Conversations Client

Issue:
Cannot create a Conversations Client

Steps Taken:
-Build Project on Android Studio 4.1
-Generate Access Token in Twilio CLI
-Input access token in strings.xml
-Run on Android Simulator
-Try to send message

Error Messages Seen:
2021-05-27 17:35:49.518 8843-8843/com.twilio.conversationsquickstart E/emchamptag: Error creating Twilio Conversations Client: Command timeout reached

Full Run Log is attached

error_conversations.txt

Unable to send message

Hi sir, we are looking to add video chat and text chat in our applikcation using twilio. Wanted to see the working of conversations. I followed the steps and replaced my access token by generating one using the mentioned command, but when i run the app and click on send message nothing happens. Am i supposed to do something else as well? Do i need to make the user join some channel or add participants for the demo to work? All I want is to see how chat works. Is there a way to enable logging so I can see the exact cause

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.