---
sourceDocument: Referência de API do Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência de API do Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# Classe NowPushSDK - Android

# Classe NowPushSDK - Android {#ariaid-title1}

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

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

## 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 da instância ServiceNow 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 |
|-|-|
| Resultado\<NowPushService\> | Objeto NowPushService encapsulado em um [objeto Resultado do Kotlin](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-result/). |
[Tabela 2. Retorna]

{#NPushSDK-makePushService_S_O_O__table_uzv_sxj_nrb}  
Este exemplo mostra como configurar o método makePushService() 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 }
    }


