본문으로 건너뛰기

Make the first API call

Fused Location API 사용 방법

Fused Location API는 아래와 같이 사용할 수 있습니다.

예제코드를 확인해주세요.

API 호출 순서

1. Initialize SDK

Fused Location SDK를 시작할 때 initialize API를 호출하여 SDK를 초기화합니다.

val fusedLocation:FusedLocation = FusedLocation(context)
fusedLocation.initialize()

2. Add Listener

registerFusedLocationCallback API를 호출하여 FusedLocation 콜백을 등록합니다.

fusedLocation.registerFusedLocationCallback(listener: ai.pleos.playground.location.fused.listener.FusedLocationListener)

3. Remove Listener

앱을 종료하기에 앞서 등록했던 FusedLocation 콜백을 해제합니다. 콜백을 해제하려면 unregisterFusedLocationCallback API를 호출합니다.

fusedLocation.unregisterFusedLocationCallback(listener: ai.pleos.playground.location.fused.listener.FusedLocationListener)

4. Release SDK

release API를 호출하여 Fused Location SDK 리소스를 해제합니다.

fusedLocation.release()