NowPushSDK 클래스 - Android

  • 릴리스 버전: Washingtondc
  • 업데이트 날짜 2024년 02월 01일
  • 읽기1분
  • NowPushSDK 클래스는 장치에 원치 않는(푸시) 알림을 보낼 수 있는 NowPushServiceAndroid 만드는 데 필요한 기능을 제공합니다.

    NowPushSDK - makePushService(instanceURL: URL)

    NowPush 서비스를 작성합니다.

    표 1. 매개변수
    이름 유형 설명
    인스턴스URL URL ServiceNow NowPushService가 상호작용해야 하는 인스턴스의 URL입니다.
    표 2. 반환
    유형 설명
    결과<NowPushService> Kotlin Result 객체에 래핑된 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 }
    }