NowPushSDK 클래스 - Android
NowPushSDK 클래스는 원치 않는(푸시) 알림을 Android 장치에 보낼 수 있는 NowPushService를 만드는 데 필요한 기능을 제공합니다.
NowPushSDK - makePushService(instanceURL: URL)
NowPush 서비스를 작성합니다.
| 이름 | 유형 | 설명 |
|---|---|---|
| 인스턴스 URL | URL | ServiceNow NowPushService가 상호작용해야 하는 인스턴스의 URL입니다. |
| 유형 | 설명 |
|---|---|
| 결과<NowPushService> | NowPushService 객체가 Kotlin Result 객체로 래핑됩니다. |
이 예제는 푸시 서비스를 생성하기 위해 makePushService() 메소드를 설정하는 방법을 보여줍니다.
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 }
}