2012-07-23 1 views
2

이 티타늄 Appcelerator에 내 코드입니다 :Titanium.Geolocation.getCurrentPosition() 포기하지 않을 출력

나는 그것이 위치는 현재 사용할 수 없습니다 "독서 팝업을주고있다 안드로이드 에뮬레이터에서이 코드를 실행하고
function ApplicationWindow(title) { 
    var self = Ti.UI.createWindow({ 
     title:title, 
     backgroundColor:'white' 
    }); 

     var button = Ti.UI.createButton({ 
     height:44, 
     width:200, 
     title:L('openWindow'), 
     top:200 
    }); 


    self.add(button); 

    function getPosition() { 
     alert("In the Function"); 
     Titanium.Geolocation.getCurrentPosition(function(e) { 
        Titanium.Geolocation.distanceFilter = 10; 
        Ti.Geolocation.preferredProvider = "gps"; 

        if (e.error) { 
         Ti.UI.createAlertDialog({ 
          title: L('geolocate_failure'), 
          message: e.error 
         }).show(); 
         return; 
        } 
        var found = new Object(); 
        locateIndicator.show(); 
        found.longitude = e.coords.longitude; 
        found.latitude = e.coords.latitude; 
        found.altitude = e.coords.altitude; 
        found.heading = e.coords.heading; 
        found.accuracy = e.coords.accuracy; 
        found.speed = e.coords.speed; 
        found.timestamp = e.coords.timestamp; 
        found.altitudeAccuracy = e.coords.altitudeAccuracy; 
        return found 
       }); 
    } 

button.addEventListener('click', function() { 
     alert("button click"); 
     getPosition(); 
    }); 
    return self; 
}; 

module.exports = ApplicationWindow; 

. " 모바일 (GPS 사용)에서이 코드를 실행하기 전까지는 의미합니까? GPS 관련 출력을 내게주지는 않습니까? 아니면 내 코드가있는 것입니까?
감사합니다.

답변

2

에뮬레이터에서 위치 정보 서비스를 실행하려면 위도와 경도를 ddms로 설정해야합니다.