Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

NowWebSDK class- Android

The NowWebSDK class provides a single function that enables you to load web pages hosted on your ServiceNow instance in a native web view and Cabrillo. It automatically handles user authentication and session management instead of forcing users to log into the instance through a login web page.

Parent Topic:Mobile SDK - Android

NowWebSDK - makeWebService(instanceURL: URL, nowWebSdkCallbacks: NowWebViewServiceDelegate? = null)

Creates a NowWeb service.

NameTypeDescription
instanceURLURLURL of the ServiceNow instance to access. For example, "https://instance.servicenow.com"
nowWebSdkCallbacksNowWebViewServiceDelegateCallbacks for the host application to configure NowWebService.
TypeDescription
Result<NowWebService>NowWebService object wrapped in a Kotlin Result object.

The following code example shows how to call this function.

 private var nowWebService: NowWebService? = null

/**
  * Create the NowWebService once in the lifetime of the application, inside the Application
  * class or another manager class that will be injected into other classes via dagger/hilt.
  * NowWebService should be created after initializing the NowSDK.
  */
suspend fun getNowWebService(): NowWebService? {
  if (nowWebService != null) return nowWebService

  return NowWebSDK.makeWebService(URL("https://instance-name.service-now.com"), object :
    NowWebViewServiceDelegate {
    override fun flowEnded(activity: Activity, flowName: String?) {
      Log.i("NowWebSdk", "flow ended")
    }

    override fun requestedDismissal(activity: Activity) {
      Log.i("NebWebSdk", "screen should be dismissed")
    }

    override fun navigationFailed(activity: Activity, error: String) {
      Log.i("NebWebSdk", "navigation failed")
    }

    override fun unsupportedUrl(activity: Activity, uri: Uri) {
      Log.i("NebWebSdk", "URL is unsupported")
    }
  }).getOrThrow()
      .also { this.nowWebService = it }
}