communication-ui-library-an.../azure-communication-ui/chat
pavelprystinka 47cc3dec7a
[Calling][Release] Calling 1.6.0 (#956)
2024-02-29 17:10:17 -08:00
..
src [Release] Chat-1.0.0 beta 3 (#887) 2023-12-21 10:04:43 -08:00
.gitignore
README.md [Release] Chat-1.0.0 beta 3 (#887) 2023-12-21 10:04:43 -08:00
build.gradle [Calling][Release] Calling 1.6.0 (#956) 2024-02-29 17:10:17 -08:00
consumer-rules.pro
proguard-rules.pro
publish.gradle

README.md

A banner image that shows some use cases of the Chat UI library

Azure Communication UI Mobile Library for Android - Chat

Latest Release

Getting Started

Get started with Azure Communication Chat Services by using the UI Library to integrate communication experiences into your applications. For instructions to quickly integrate the UI Library functionalities Quick-start Documentation.

Installation

In your app level (app folder) build.gradle, add the following lines to the dependencies and android sections.

android {
    ...
    packagingOptions {
        pickFirst  'META-INF/*'
    }
    ...
}
dependencies {
    ...
    implementation 'com.azure.android:azure-communication-ui-chat:1.0.0-beta.3'
    ...
}

In your project gradle scripts add following lines to repositories. For Android Studio (2020.*) the repositories are in settings.gradle dependencyResolutionManagement(Gradle version 6.8 or greater). If you are using old versions of Android Studio (4.*) then the repositories will be in project level build.gradle allprojects{}.

repositories {
    ...
    mavenCentral()
    maven {
        url "https://pkgs.dev.azure.com/MicrosoftDeviceSDK/DuoSDK-Public/_packaging/Duo-SDK-Feed/maven/v1"
    }
    ...
}

Sync project with gradle files. (Android Studio -> File -> Sync Project With Gradle Files)

Quick Sample

Create ChatComposite and launch it. Replace <USER_ACCESS_TOKEN> with your token and <USER_ID> with your identity string from your azure communication resource's Identity & User Access Tokens settings. Also replace <DISPLAY_NAME> with your name and <THREAD_ID> with your chat thread ID and <ENDPOINT_URL> with your endpoint from your communication resource.

Kotlin

val communicationTokenRefreshOptions = CommunicationTokenRefreshOptions("<USER_ACCESS_TOKEN>", true)
val communicationTokenCredential = CommunicationTokenCredential(communicationTokenRefreshOptions)


val chatAdapter = ChatAdapterBuilder()
    .endpoint("<ENDPOINT_URL>")
    .credential(communicationTokenCredential)
    .identity(CommunicationUserIdentifier("<USER_ID>"))
    .displayName("<DISPLAY_NAME>")
    .threadId("<THREAD_ID>")
    .build()

chatAdapter.connect(context)

val chatThreadView = ChatThreadView(context, chatAdapter)

Java

CommunicationTokenRefreshOptions communicationTokenRefreshOptions = new CommunicationTokenRefreshOptions("<USER_ACCESS_TOKEN>", true);
CommunicationTokenCredential communicationTokenCredential = new CommunicationTokenCredential(communicationTokenRefreshOptions);

ChatAdapter chatAdapter = new ChatAdapterBuilder()
        .endpoint("<ENDPOINT_URL>")
        .credential(communicationTokenCredential)
        .identity(new CommunicationUserIdentifier("<USER_ID>"))
        .displayName("<DISPLAY_NAME>")
        .threadId("<THREAD_ID>")
        .build();

chatAdapter.connect(context);

ChatThreadView chatThreadView = new ChatThreadView(context, chatAdapter);

Chat screen is supported as both composite and an independent view which supports view binding and enables the application developers to integrate the chat capabilities in their application in either way. For example, one can launch ChatComposite in either the application activity or on any inflated view. You can find the detail of using the Chat UI Library in the Demo Guide.

For more details on Mobile UI Library functionalities visit the API Reference Documentation.

Known Issues

Please refer to the wiki for known issues related to the library.

Further Reading