Classe NowPushSDK - Android
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)
Cria um serviço NowPush.
| Nome | Tipo | Descrição |
|---|---|---|
| instanceURL | URL | URL da instância ServiceNow com a qual o NowPushService deve interagir. |
| Tipo | Descrição |
|---|---|
| Resultado<NowPushService> | Objeto NowPushService encapsulado em um objeto Resultado do Kotlin. |
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 }
}