Titanium GPS 체크 문의 드립니다

Titianium SDK 버전 : 3.1.3.GA

Alloy version : 1.0

OS 버전 : Window7 / 32bit

mobile OS 버전 : android 4.x

if(Titanium.Geolocation.locationServicesEnabled)
{
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = 10;
Titanium.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;
Titanium.Geolocation.getCurrentPosition(function (e)
{
if (e.error)
{
// manage the error
return;
}

		currLongitude = e.coords.longitude;
		currLatitude = e.coords.latitude;
 
              
      });

}

현재 소스는 이렇게 되어있습니다.
문제는 앱에서 off 되어있는 gps 기능을 on 시켰을 때,

Titanium.Geolocation.getCurrentPosition 이 먹히지 않습니다 ㅠㅠ

GPS의 ON/OFF 상태를 수시로 체크하여 현재 위치를 좌표로 알고 싶은데
코드상에 어떤 문제가 있는 걸까요 ㅠㅠ?

코드상으로는 GPS가 켜져있다면 현재 위치를 가져오는 액션을 한번 수행하는 코드에 불과합니다.
ON/OFF 상태에 대한 수시 체크 부분을 따로 구현하셔야합니다.

검색을 좀 해보니 보통 수시로 체크하지않고, GPS가 OFF 상태면 다이얼로그를 띄워서 “GPS가 꺼져있는데 켤꺼냐?” 물어보고 바로 GPS 설정창으로 보내서 사용자가 직접 ON 하도록 유도하는 방식으로 구현하네요.

참고하세요.
http://developer.appcelerator.com/question/133452/gps-status-on-android

1개의 좋아요

감사합니다!!!