---
sourceDocument: Référence de l’API Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/fr-FR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - fr-FR

ft:publication_title :

    - Référence de l’API Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe NowChatSDK : Android

# Classe NowChatSDK : Android {#ariaid-title1}

* Rversion finale: Xanadu
* 
* Mis à jour 1 août 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute de lecture

La classe NowChatService fournit la fonction nécessaire pour créer un NowChatService qui interagit avec NowChat. NowChat offre la possibilité d'intégrer Agent actif et Agent virtuel dans votre application.
Pour plus d'informations sur et , reportez-vous Agent actif à la section [Virtual Agent](https://www.servicenow.com/docs/access?context=virtual-agent-landing-page&version=xanadu&pubname=xanadu-conversational-interfaces&ft:locale=en-US).Agent virtuel

## NowChatSDK : makeChatService(instanceURL : URL, nowChatSdkCallbacks) {#ariaid-title2}

Crée un service Now Chat. Il s'agit d'une fonction de suspension.
{#NChatSDK-makeChatService_S_S_S_S__table_nvq_fzc_npb__entry__3}

| Nom | Type | Description |
|-|-|-|
| instanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL de l'instance ServiceNow avec laquelle le NowChatService doit interagir. |
| nowChatSdkCallbacks | [NowChatSdkCallbacks](https://servicenow-prod.fluidtopics.net/xy76vvGqRj~4pvVBXYEeww#NowChatSdkCallbacksAndroidInt "L’interface NowChatSdkCallbacks fournit des fonctions qui activent les rappels pour les applications hôtes afin de configurer ou de gérer les actions à partir du NowChatSDK.") | Rappels pour l'application hôte à utiliser pour configurer NowChatService. |
[Tableau 1. Paramètres]

{#NChatSDK-makeChatService_S_S_S_S__table_nvq_fzc_npb} {#NChatSDK-makeChatService_S_S_S_S__table_ovq_fzc_npb__entry__2}

| Type | Description |
|-|-|
| Aucun |   |
[Tableau 2. Renvoie]

{#NChatSDK-makeChatService_S_S_S_S__table_ovq_fzc_npb}  

    @Inject lateinit var sdkSettingsProvider: Provider<NowSDKSettings>
    @Inject lateinit var chatCallbacks: SampleAppNowChatSDKCallbacks

    private fun launchChat() {
      binding.progressBar.visibility = View.VISIBLE

      NowChatSDK.makeChatService(
        URL(sdkSettingsProvider.get().instanceBaseURL),
        chatCallbacks
      ) .onSuccess {
        it.start(this, chatCallbacks.nowChatThemeColors) }
      } .onFailure {
         Log.e("NowChat", "Unable to launch chat: $it")
      }
    }


