Git Product home page Git Product logo

twiliochat-android's Introduction

Twilio

Important Notice

We intend to sunset the Programmable Chat API on July 25, 2022 to focus on the next generation of chat: the Twilio Conversations API. Find out about the EOL process. We have also prepared this Migration Guide to assist in the transition from Chat to Conversations.

Twilio chat - Android

Build Status

Learn to implement a simple chat application using Twilio Programmable Chat Client

Read the full tutorial here!

Local development

  1. Clone the repository.
$ git clone https://github.com/TwilioDevEd/twiliochat-android.git
$ cd twiliochat-android
  1. This application was developed using Android Studio. So if you are using a different tool like Eclipse with ADT, there might be some additional steps you need to follow. If you are using Android Studio just open the project using the IDE.

  2. Twilio's Programmable Chat Client requires an access token generated using your Twilio credentials in order to connect. First we need to setup a server that will generate this token for the mobile application to use. We have created web versions of Twilio Chat, you can use any of these applications to generate the token that this mobile app requires, just pick you favorite flavor:

    Look for instructions on how to setup these servers in any of the links above.

  3. Once you have the server running (from the previous step), you need to edit one file in this android application.

    ProjectRoot(app) -> res -> values -> keys.xml (on the Android Studio)
    or
    ProjectRoot/app/src/main/res/values/keys.xml (on the file system)
    

    This file contains the token_url key. The default values is http://10.0.2.2:8000/token. This address refers to the host machine loopback interface (127.0.0.1) when running this application in the android emulator. You must change this value to match the address of your server running the token generation application. We are using the PHP - Laravel version in this case, that's why we use port 8000.

    Note: In some operating systems you need to specify the address for the development server when you run the Laravel application, here's an example:

    $ php artisan serve --host=127.0.0.1
    
  4. Now Twilio Chat is ready to go. Run the application on the android emulator or your own device. Make sure that you have properly set up the token generation server and the token_url key. To run the application in a real device you'll need to expose your local token generation server by manually forwarding ports, or using a tool like ngrok. If you decide to work with ngrok, your keys.xml file should hold a key like the following:

    <string name="token_url">"http://<your_subdomain>.ngrok.io/token"</string>
    

    No need to specify the port in this url, as ngrok will forward the request to the specified port.

Meta

  • No warranty expressed or implied. Software is as is. Diggity.
  • MIT License
  • Lovingly crafted by Twilio Developer Education.

twiliochat-android's People

Contributors

hortega avatar jefflinwood avatar kathyguerron avatar kwhinnery avatar mcelicalderon avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

twiliochat-android's Issues

Request to EMS service has failed, unable to set FPA token when running sample App

Issue occurs in -

private void initializeClient() {
chatClientManager.connectClient(new TaskCompletionListener<Void, String>() {
@OverRide
public void onSuccess(Void aVoid) {
populateChannels();
}

  @Override
  public void onError(String errorMessage) {
    stopActivityIndicator();
    showAlertWithMessage("Client connection error");
  }
});

}

This is when it has shown the message getting channels. The message shown to the user is Client Connection error - however the underlying message is 'Request to EMS service has failed, unable to set FPA'

I know the server works find as the server tests run okay, and I have connected the iOS App to the Server and it is working fine.

Android app crash after ending and closing chat

There is no exception that is caught.
I am only getting these errors -

E/libc++abi: terminating with uncaught exception of type std::range_error: wstring_convert: from_bytes error

A/libc: Fatal signal 6 (SIGABRT), code -6 (SI_TKILL) in tid 31131 (.packageName), pid 31131 (.packageName)

A/libc: FORTIFY: pthread_mutex_destroy called on a destroyed mutex (0x719c91b9a0)

Stucked at The "Loading Channel Information"

I created an account on twilio also created my own server which fetches me the token, I made required changes according to the latest sdk in this app but i am stuck in the populateChannel method on mainchatActivity.

java.lang.NoSuchFieldError: No static field INSTANCE of type Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; in class Lorg/apache/http/conn/ssl/AllowAllHostnameVerifier; or its superclasses (declaration of 'org.apache.http.conn.ssl.AllowAllHostnameVerifier' appears in /system/framework/framework.jar!classes3.dex)

Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

  // Getting list of servcies
  Service service = Service.fetcher(CHAT_SERVICE_ID)
          .fetch();

Using implementation "com.twilio:chat-android:3.1.1"
implementation group: "com.twilio.sdk", name: "twilio", version: "7.42.0"
implementation 'com.twilio:accessmanager-android:0.1.0'

Login Issue

Hi

I have already create Auth token from our server with own api so no need to generate auth token from ngrok then where i should place generated auth token and one more thing what should i pass in username field...?

when i pass dummy username then it will displaying sign in dialog continuously , not getting channel list, so how can i get channel list from twillio account or any general channel list

Help me.
Thanks.

Obsolete SDK versions

JFYI, compile "com.twilio:chat-android:0.11.2" is a pre-release version that is no longer supported and it will not even connect nowadays.

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.