NowVoiceService class - Android

concept australia Updated Sep 10, 2026 4 min read NowVoiceServiceAndroidAPI.md
Raw file servicenow.com

Manages voice agent sessions for a single ServiceNow instance.

Note: Initialize a NowVoiceService by calling NowVoiceSDK - makeVoiceService(instanceURL: URL).

Name

Type

Description

configuration

NowServiceConfiguration

The service configuration for the ServiceNow instance.

isMuted

Boolean

Flag that indicates the microphone mute state for the current call. Setting this property has no effect if no call is currently active.Valid values:

  • true: The microphone is muted.
  • false: The microphone is unmuted or no call is active.

nowVoiceEndpoints

List<NowVoiceEndpoint>

Read-only. The list of available voice endpoint configurations retrieved from the instance.

**Parent Topic:**[Mobile SDK - Android](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/cllent-mobile-api-reference/MobileSDKAndroidAPI.md)

NowVoiceService - endCall()

Ends the current voice call.

Has no effect if no call is active.

Name Type Description
None
Type Description
None

The following code example ends the active voice call.

JavaScript
val voiceService = NowVoiceSDK.makeVoiceService(instanceUrl).getOrNull()
val endpoint = voiceService?.nowVoiceEndpoints?.first()voiceService?.start(activity, endpoint = endpoint, theme = theme)
// End a call on timeout, navigation, or from a custom hang-up buttonvoiceService?.endCall()

NowVoiceService - hasActiveCall()

Checks whether there is a currently active voice call.

Name Type Description
None

Type

Description

Boolean

Flag that indicates whether there is an active voice call.Valid values:

  • true: There is an active voice call.
  • false: There isn't an active voice call.
The following code example checks if a voice call is in progress.
JavaScript
val voiceService = NowVoiceSDK.makeVoiceService(instanceUrl).getOrNull()
val endpoint = voiceService?.nowVoiceEndpoints?.first()voiceService?.start(activity, endpoint = endpoint, theme = theme)
// Guard UI state or prevent starting a second callif (voiceService?.hasActiveCall() == true) {    // A voice call is currently in progress}

NowVoiceService - start(context: Context, endpoint: NowVoiceEndpoint, uiConfiguration: NowVoiceUiConfiguration, callbacks: NowVoiceCallbacks?, theme: NowVoiceTheme)

Launches the full-screen voice agent Activity. This is a suspend function that returns after the session ends.

Name

Type

Description

context

Context

An Android Context used to launch the voice Activity. Typically your current Activity.

endpoint

NowVoiceEndpoint

The voice agent endpoint to connect to. Obtain from NowVoiceService.nowVoiceEndpoints.

uiConfiguration

NowVoiceUiConfiguration

Optional. Presentation options for the voice agent UI. If omitted, uses the default values for NowVoiceUiConfiguration.

callbacks

NowVoiceCallbacks?

Optional. Callbacks for voice session events. If null, events are silently ignored.

theme

NowVoiceTheme

Optional. The visual theme applied to the voice UI.Default: The prebuilt light theme.

|Type|Description| |----|-----------| |None| |

The following code example shows how to call this function.

JavaScript
//voiceService is an initialized NowVoiceServiceval endpoint = voiceService.nowVoiceEndpoints.firstOrNull() ?: return
voiceService.start(    context = this@MainActivity,    endpoint = endpoint,    uiConfiguration = NowVoiceUiConfiguration(        hidePostCallTranscript = false,        shouldBlockAttachmentSharing = false    ),    callbacks = object : NowVoiceCallbacks {        override fun onCallEnd(conversationId: String?, error: NowVoiceError?) {            if (error != null) {                Log.e("NowVoice", "Session ended with error: $error")            } else {                Log.d("NowVoice", "Session complete. ID: $conversationId")            }        }
        override fun onMuteStateChanged(isMuted: Boolean) {            // Update your UI to reflect the current mute state            Log.d("NowVoice", "Microphone muted: $isMuted")        }
        override fun onMessageReceived(message: TranscriptMessage) {            // Receive real-time transcript messages            Log.d("NowVoice", "${message.role}: ${message.content}")        }    },    theme = object : NowVoiceTheme {}  // Uses default light theme)

NowVoiceService - toggleMute()

Toggles the microphone mute state of the current call.

Name Type Description
None

Type

Description

Boolean

Flag that indicates the new microphone mute state for the current call.Valid values:

  • true: The microphone is now muted.
  • false: The microphone is now unmuted or no call is active.
The following code example toggles and reads the microphone mute state.
JavaScript
val voiceService = NowVoiceSDK.makeVoiceService(instanceUrl).getOrNull()
val endpoint = voiceService?.nowVoiceEndpoints?.first()voiceService?.start(activity, endpoint = endpoint, theme = theme)
// Wire to a custom mute button or auto-mute on backgroundingvoiceService?.toggleMute()
// Check mute state to update a custom mute button iconval muted = voiceService?.isMuted ?: false

NowVoiceService - updateTheme(theme: NowVoiceTheme)

Updates the visual theme of the currently active voice UI.

This function has no effect if no voice session is currently active. To apply a visual theme at voice session launch, provide a theme when calling start(context:endpoint:uiConfiguration:callbacks:theme:).

Name Type Description
theme NowVoiceTheme The theme to apply to the active voice UI.
Type Description
None

The following code example updates the visual theme of the currently active voice UI.

JavaScript
val voiceService = NowVoiceSDK.makeVoiceService(instanceUrl).getOrNull()
val endpoint = voiceService?.nowVoiceEndpoints?.first()voiceService?.start(activity, endpoint = endpoint, theme = theme)
// React to dark mode changes or apply brand colors at runtimevoiceService?.updateTheme(NowVoiceThemeDark())
Search documentation
Search document titles and file paths on the australia branch