NowPushSDK クラス - Android
NowPushSDK クラスは、デバイスへのAndroid非送信請求 (プッシュ) 通知の送信を可能にする NowPushService を作成するために必要な機能を提供します。
NowPushSDK - makePushService(instanceURL: URL)
NowPush サービスを作成します。
| 名前 | タイプ | 説明 |
|---|---|---|
| instanceURL | URL | NowPushService がやり取りする必要があるインスタンスの ServiceNow URL。 |
| タイプ | 説明 |
|---|---|
| 結果<NowPushService> | Kotlin 結果オブジェクトにラップされた NowPushService オブジェクト。 |
この例は、プッシュサービスを作成するために 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 }
}