NowChatSDK class - Android

  • リリースバージョン: Australia
  • 更新日 2026年03月12日
  • 所要時間:2分
  • The NowChatService class provides the function necessary to create a NowChatService that interacts with NowChat. NowChat provides the ability to embed Live Agent and Virtual Agent within your application.

    For additional information on Live Agent and Virtual Agent, see Virtual Agent.

    NowChatSDK - makeChatService(instanceURL: URL, nowChatSdkCallbacks)

    Creates a NowChat service. This is a suspend function.

    表 : 1. Parameters
    Name Type Description
    instanceURL URL URL of the ServiceNow instance that the NowChatService should interact with.
    nowChatSdkCallbacks NowChatSdkCallbacks Callbacks for the host application to use to configure the NowChatService.
    表 : 2. Returns
    Type Description
    None
    @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")
      }
    }