Search in sources :

Example 1 with ChatClientBuilder

use of com.azure.android.communication.chat.ChatClientBuilder in project azure-sdk-for-android by Azure.

the class MainActivity method createChatAsyncClient.

public void createChatAsyncClient() {
    try {
        chatAsyncClient = new ChatClientBuilder().endpoint(endpoint).credential(new CommunicationTokenCredential(firstUserAccessToken)).addPolicy(new UserAgentPolicy(APPLICATION_ID, SDK_NAME, sdkVersion)).httpLogOptions(new HttpLogOptions().setLogLevel(HttpLogDetailLevel.BODY_AND_HEADERS).addAllowedHeaderName("MS-CV")).buildAsyncClient();
        Log.d(TAG, "Created ChatAsyncClient");
    } catch (Exception e) {
        Log.e("ChatAsyncClient creation failed", Objects.requireNonNull(e.getMessage()));
    }
}
Also used : ChatClientBuilder(com.azure.android.communication.chat.ChatClientBuilder) UserAgentPolicy(com.azure.android.core.http.policy.UserAgentPolicy) CommunicationTokenCredential(com.azure.android.communication.common.CommunicationTokenCredential) HttpLogOptions(com.azure.android.core.http.policy.HttpLogOptions) ExecutionException(java.util.concurrent.ExecutionException)

Aggregations

ChatClientBuilder (com.azure.android.communication.chat.ChatClientBuilder)1 CommunicationTokenCredential (com.azure.android.communication.common.CommunicationTokenCredential)1 HttpLogOptions (com.azure.android.core.http.policy.HttpLogOptions)1 UserAgentPolicy (com.azure.android.core.http.policy.UserAgentPolicy)1 ExecutionException (java.util.concurrent.ExecutionException)1