Classe NowPushSDK - Android

  • Versão de lançamento: Zurich
  • Atualizado 31 de jul. de 2025
  • 1 min. de leitura
  • . NowPushSDK a classe fornece a função necessária para criar um NowPushService que permite o envio de notificações não solicitadas (por push) para Android dispositivos.

    NowPushSDK - makePushService(instanceURL: URL)

    Cria um serviço NowPush.

    Tabela 1. Parâmetros
    Nome Tipo Descrição
    InstanceURL URL URL do ServiceNow Instância com a qual o NowPushService deve interagir.
    Tabela 2. Retornos
    Tipo Descrição
    <NowPushService> Objeto NowPushService encapsulado em um Objeto de resultado do Kotlin .

    Este exemplo mostra como configurar para MakePushService() Método para criar o serviço de push.

    private var nowPushService: NowPushService? = null
    
    /**
      * Create the NowPushService 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.
      * NowPushService should be created after initializing the NowSDK.
      */
    suspend fun getNowPushService(): NowPushService? {
      if (nowPushService != null) return nowPushService
    
      return NowPushSDK.makePushService(URL("https://instance-name.service-now.com")).getOrThrow()
        .also { this.nowPushService = it }
    }