geolocation


geolocation 은 HSP 에서 기본으로 제공하는 API로 별도의 설정 없이 사용 가능하며 위치 정보 기능을 활용한 기능이다.


getCurrentPosition

현재 위치정보를 읽어온다.

Example

DAPGeolocation.getCurrentPosition({ resultDict in
   // TODO
}, failure: { error in
   // TODO
})
[DAPGeolocation getCurrentPosition:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

watchPosition

현재 위치정보를 주기적으로 읽어온다.

options

필드설명비고M/O
interval정보 갱신 시간(ms) M
watchIdwatch 아이디문자열M
    

Example

let watchId = "id"
let interval = NSNumber(value: 3000)
DAPGeolocation.watchPosition(watchId, interval: interval, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSString *watchId = @"id";
NSNumber *interval = @3000;
[DAPGeolocation watchPosition:watchId interval:interval completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

clearWatch

동작중인 watch를 종료한다.

options

필드설명비고M/O
watchId동작중인 watch 아이디watchPosition 에서 생성한 watchId 사용M
    

Example

let watchId = "id"
DAPGeolocation.clearWatch(watchId, completion: { resultDict in
   // TODO
}, failure: { error in
   // TODO
})
NSString *watchId = @"id";
[DAPGeolocation clearWatch:watchId completion:^(NSDictionary *resultDict) {
   // TODO
} failure:^(NSError *error) {
   // TODO
}];

Error code

CodeCauseComment
E10500파라메터 값이 잘못되어 있을 경우 
E10501전달된 액션 값이 알 수 없는 액션일 경우 
E10502정보 갱신 시간 정보가 잘못되어 있을 경우 
E10503watch 아이디 값이 없거나 nil 인 경우 
E10550실행 중 오류가 발생 되었을 경우 
E10551watchPosition 요청 시 watch 아이디 값이 존재하는 경우 
E10552clearWatch 요청 시 watch 아이디 값을 찾을 수 없는 경우 
E10553위치 정보을 얻기위한 서비스가 지원하지 않는 경우 
E10599알 수없는 오류가 발생 되었을 경우