---
sourceDocument: 호주 API 참조
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ko-KR/api-reference

 Release :

    - australia

ft:locale :

    - ko-KR

ft:publication_title :

    - 호주 API 참조

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# NowChatService 클래스 - Android

# NowChatService 클래스 - Android {#ariaid-title1}

* 릴리스 버전: Australia
* 
* 업데이트 날짜 2026년 03월 12일
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 소요 시간: 8분

NowChatService 클래스는 NowChat 활동을 시작하고 오류 구성을 설정할 수 있는 기능을 제공합니다.

## NowChatService - launchIntent(context:Context, nowChatTheme:NowChatTheme):의도 {#ariaid-title2}

NowChat 활동을 여는 데 사용되는 의도를 시작합니다. 일반적으로 `[android.app.PendingIntent]`를 만드는 데 사용됩니다.
{#NChatServA-launchIntent_O_O__table_yv2_43l_nrb__entry__3}{#NChatServA-launchIntent_O_O__Chat-themeColors-ph}

| 이름 | 유형 | 설명 |
|-|-|-|
| 컨텍스트 | 컨텍스트 | 의도를 빌드하는 데 사용되는 컨텍스트입니다. |
| nowChat테마 | [나우챗테마](https://servicenow-prod.fluidtopics.net/E41uz8n~G5qCrNZYsTyP8w "NowChatTheme 인터페이스는 채팅 가상 에이전트 UI의 요소에 대한 기본 색상을 정의합니다라이브 에이전트.") | 옵션입니다. NowChat UI에서 사용할 테마 객체입니다. 기본값: 기본 색상 |
[표 1. 매개변수]

{#NChatServA-launchIntent_O_O__table_yv2_43l_nrb} {#NChatServA-launchIntent_O_O__table_zv2_43l_nrb__entry__2}

| 유형 | 설명 |
|-|-|
| 의도 | 연결된 NowChat 활동을 시작하는 데 사용되는 의도 및 테마 색상입니다. |
[표 2. 반환]

{#NChatServA-launchIntent_O_O__table_zv2_43l_nrb}  
이 예제에서는 launchIntent() 메서드를 호출하고 반환 활동을 처리하는 방법을 보여줍니다.

    val intent = nowChatService.launchIntent(this) 
    val pendingIntent = PendingIntent.getActivity( 
        this, 
        REQUEST_CODE,
        intent,
        PendingIntent.FLAG_IMMUTABLE 
    ) 

    val notification = createNotification(title, message, pendingIntent)
    notificationManager.notify(push.notificationId, notification) 

## NowChatService - start(activity: Activity, themeColors: NowChatTheme = object: NowChatTheme{}, contextData: map\<String, Any\> = mapOf(), chatConfiguration: NowChatConfiguration? = null) {#ariaid-title3}

지정된 NowChat 활동을 시작합니다.
{#NChatServA-start_O_O__table_lbg_cyg_tpb__entry__3}{#NChatServA-start_O_O__Chat-themeColors-ph}

| 이름 | 유형 | 설명 |
|-|-|-|
| 활동 | [활동](https://developer.android.com/reference/kotlin/android/app/Activity.html) | NowChat 활동을 시작하고 onActivityResult를 통해 `NowChatExitCode`를 resultCode로 수신하는 데 사용할 활동 컨텍스트입니다. |
| nowChat테마 | [나우챗테마](https://servicenow-prod.fluidtopics.net/E41uz8n~G5qCrNZYsTyP8w "NowChatTheme 인터페이스는 채팅 가상 에이전트 UI의 요소에 대한 기본 색상을 정의합니다라이브 에이전트.") | 옵션입니다. NowChat UI에서 사용할 테마 객체입니다. 기본값: 기본 색상 |
| 컨텍스트 데이터 | 맵\<문자열, 임의\> | 옵션입니다. 채팅 세션에 전달할 추가 채팅 컨텍스트 변수입니다. 채팅 컨텍스트 변수에 대한 자세한 내용은 다음 문서를 참조하십시오 [Live agent chat context variables](https://www.servicenow.com/docs/access?context=live-agent-chat-context-vars&version=australia&pubname=australia-conversational-interfaces&ft:locale=en-US). |
| chat구성 | [NowChat구성](https://servicenow-prod.fluidtopics.net/mzDTntaH4oWC_xHawFwxhA#NowChatOptionsAndroid "NowChatConfiguration 클래스를 사용하면 채팅 창을 닫기 전 프롬프트 표시, 채팅 사용 중 기능 비활성화, 채팅 사용 시 다른 대화 옵션 적용, NowChat에서 UI 구성요소 구성 등의 채팅 세션 옵션을 구성할 수 있습니다.") | 옵션입니다. NowChat을 사용하는 동안 적용할 ChatConfiguration입니다. |
[표 3. 매개변수]

{#NChatServA-start_O_O__table_lbg_cyg_tpb} {#NChatServA-start_O_O__table_mbg_cyg_tpb__entry__2}

| 유형 | 설명 |
|-|-|
| 없음 |   |
[표 4. 반환]

{#NChatServA-start_O_O__table_mbg_cyg_tpb}  
다음 코드 예제에서는 이 함수를 호출하는 방법을 보여 줍니다.

    suspend fun launchChat() {
        val chatService = getNowChatService()

        val chatTheme = object : NowChatTheme {
            override val brand: Int
                get() = Color.BLUE

            override val textPrimary: Int
                get() = Color.BLACK

            // Override remaining theme colors

        }
        val contextData = mapOf("sys_id" to "123456789", "table" to "wm_task")

        //drawable to be used instead of the default NowChat back button.
        val myDrawable = ContextCompat.getDrawable(activity, R.drawable.my_drawable)

        val chatConfiguration = NowChatConfiguration(
            closePrompt = NowChatConfiguration.ClosePrompt(
                header = null,
                message = "Are you sure you want to leave?",
                acceptButtonTitle = "Yes",
                declineButtonTitle = "No"
            ),
            disabledFeatures = listOf(NowChatConfiguration.Feature.START_NEW_CONVERSATION),
            conversationOptions = listOf(NowChatConfiguration.ConversationOption.FORCE_NEW_CONVERSATION),
            uiConfiguration = NowChatConfiguration.UIConfiguration(
                closeButton = NowChatConfiguration.CloseButton(
                    icon = myDrawable
                ),
                attachmentUploadButton = NowChatConfiguration.AttachmentUploadButton(isVisible = false)
            )
        )

        chatService?.start(activity, chatTheme, contextData, chatConfiguration)
    }

## NowChatService - subscribeToUnreadMessageCount(pollingInterval: Long, 수신기: NowChatUnreadMessagesCountListener) {#ariaid-title4}

읽지 않은 채팅 메시지 카운트 수신기를 구독합니다.
{#NChatServA-subToUnreadMsgCnt_I_O__table_zrg_k1m_cqb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| pollingInterval | 길게 | 읽지 않은 채팅 메시지 수에 대해 웹 서비스를 폴링할 빈도입니다. 단위: 밀리초 |
| 수신기 | NowChatUnreadMessagesCountListener | 읽지 않은 채팅 메시지 수를 가져오기 위해 구현하는 수신기입니다. 또한 메서드를 사용하여 [NowChatService - unsubscribeFromUnreadMessageCount(수신기: NowChatUnreadMessagesCountListener)](https://servicenow-prod.fluidtopics.net/1gp5tk7RtXFVey_fbPKIxw#NChatServA-unsubFromUnreadMsgCnt_O "읽지 않은 메시지 카운트 수신을 구독 취소합니다.") 읽지 않은 메시지 수를 더 이상 가져오지 않으려는 경우에도 이 리스너에 대한 구독을 취소해야 합니다. |
[표 5. 매개변수]

{#NChatServA-subToUnreadMsgCnt_I_O__table_zrg_k1m_cqb} {#NChatServA-subToUnreadMsgCnt_I_O__table_asg_k1m_cqb__entry__2}

| 유형 | 설명 |
|-|-|
| 없음 |   |
[표 6. 반환]

{#NChatServA-subToUnreadMsgCnt_I_O__table_asg_k1m_cqb}  
다음 예제는 채팅 읽지 않음 메시지 카운트 수신기를 구독하고 구독 취소하는 방법을 보여줍니다.

    private val unreadMessageCountListener = object: NowChatUnreadMessagesCountListener {
      override fun unreadMessagesCountDidChange(unreadMessageCount: Int) {
      }
    }

    fun setup() {
      nowChatService.subscribeToUnreadMessageCount(pollingInterval:1000, unreadMessageCountListener)
    }

    fun teardown() {
      nowChatService.unsubscribeFromUnreadMessageCount(unreadMessageCountListener)
    }

## NowChatService - unsubscribeFromUnreadMessageCount(수신기: NowChatUnreadMessagesCountListener) {#ariaid-title5}

읽지 않은 메시지 카운트 수신을 구독 취소합니다.
{#NChatServA-unsubFromUnreadMsgCnt_O__table_inp_hbm_cqb__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| 수신기 | NowChatUnreadMessagesCountListener | 채팅 읽지 않은 메시지 카운트 수신기를 구독 취소하기 위해 구현하는 수신기입니다. |
[표 7. 매개변수]

{#NChatServA-unsubFromUnreadMsgCnt_O__table_inp_hbm_cqb} {#NChatServA-unsubFromUnreadMsgCnt_O__table_jnp_hbm_cqb__entry__2}

| 유형 | 설명 |
|-|-|
| 없음 |   |
[표 8. 반환]

{#NChatServA-unsubFromUnreadMsgCnt_O__table_jnp_hbm_cqb}  
다음 예제는 채팅 읽지 않음 메시지 카운트 수신기를 구독하고 구독 취소하는 방법을 보여줍니다.

    private val unreadMessageCountListener = object: NowChatUnreadMessagesCountListener {
      override fun unreadMessagesCountDidChange(unreadMessageCount: Int) {
      }
    }

    fun setup() {
      nowChatService.subscribeToUnreadMessageCount(pollingInterval:1000, unreadMessageCountListener)
    }

    fun teardown() {
      nowChatService.unsubscribeFromUnreadMessageCount(unreadMessageCountListener)
    }

## NowChatService -- updateTheme(nowChatTheme: NowChatTheme) {#ariaid-title6}

지정된 UI 테마로 NowChat UI 테마를 업데이트합니다. 이 함수를 사용하면 테마를 밝은 색에서 어두운 색으로 변경할 때와 같이 start() 함수를 사용하여 채팅 UI 테마를 처음 설정한 후 업데이트할 수 있습니다.
{#NCharServA-updateTheme_O__table_yzy_5jv_x2c__entry__3}

| 이름 | 유형 | 설명 |
|-|-|-|
| nowChat테마 | [나우챗테마](https://servicenow-prod.fluidtopics.net/E41uz8n~G5qCrNZYsTyP8w "NowChatTheme 인터페이스는 채팅 가상 에이전트 UI의 요소에 대한 기본 색상을 정의합니다라이브 에이전트.") | NowChat UI에서 사용할 테마 객체입니다. |
[표 9. 매개변수]

{#NCharServA-updateTheme_O__table_yzy_5jv_x2c} {#NCharServA-updateTheme_O__table_zzy_5jv_x2c__entry__2}

| 유형 | 설명 |
|-|-|
| 없음 |   |
[표 10. 반환]

{#NCharServA-updateTheme_O__table_zzy_5jv_x2c}  
다음 코드 예제는 updateTheme() 함수를 사용하여 start() 함수를 사용하여 구현된 밝은 UI 테마를 어두운 UI 테마로 업데이트하는 방법을 보여줍니다.

    val chatService = serviceManager.getNowChatService()

    val chatThemeLight = object : NowChatTheme {
        override val backgroundPrimary: Int
            get() = Color.WHITE

        override val textPrimary: Int
            get() = Color.BLACK

        // Override remaining theme colors
    }

    val chatThemeDark = object : NowChatTheme {
        override val backgroundPrimary: Int
            get() = Color.BLACK

        override val textPrimary: Int
            get() = Color.WHITE

        // Override remaining theme colors
    }

    //start NowChat with light theme
    chatService?.start(activity, chatThemeLight)


    //update NowChat theme to dark theme
    chatService?.updateTheme(chatThemeDark)


