---
sourceDocument: Referência da API de Yokohama
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/yokohama/api-reference

 Release :

    - yokohama

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência da API de Yokohama

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe NowPushSDK - Android

# Classe NowPushSDK - Android {#ariaid-title1}

* Versão de lançamento: Yokohama
* 
* Atualizado 30 de jan. de 2025
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 min. de leitura

. PushSDK a classe fornece a função necessária para criar um `NowPushService `que permite o envio de notificações não solicitadas (push) para Androiddispositivos.

## NowPushSDK - makePushService(instanceURL: URL) {#ariaid-title2}

Cria um serviço NowPush.
{#NPushSDK-makePushService_S_O_O__table_tzv_sxj_nrb__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| InstanceURL | [URL](https://developer.android.com/reference/kotlin/java/net/URL.html) | URL do ServiceNowInstância com a qual o NowPushService deve interagir. |
[Tabela 1. Parâmetros]

{#NPushSDK-makePushService_S_O_O__table_tzv_sxj_nrb} {#NPushSDK-makePushService_S_O_O__table_uzv_sxj_nrb__entry__2}

| Tipo | Descrição |
|-|-|
| \<NowPushService\> | Objeto NowPushService encapsulado em A. [Objeto de resultado de Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 2. Retornos]

{#NPushSDK-makePushService_S_O_O__table_uzv_sxj_nrb}  
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 }
    }


