Android emulator Android Geolocation无法在模拟器中获取您的位置错误

Android emulator Android Geolocation无法在模拟器中获取您的位置错误,android-emulator,geolocation,titanium-mobile,Android Emulator,Geolocation,Titanium Mobile,我试着用下面的代码来找出用户在安卓系统中的位置 application.Ti.App.GeoApp = {}; Ti.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS; Ti.Geolocation.purpose = "testing"; Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST; Titanium.Geolocation

我试着用下面的代码来找出用户在安卓系统中的位置

application.Ti.App.GeoApp = {};
Ti.Geolocation.preferredProvider = Titanium.Geolocation.PROVIDER_GPS;
Ti.Geolocation.purpose = "testing";
Titanium.Geolocation.accuracy = Titanium.Geolocation.ACCURACY_BEST;
Titanium.Geolocation.distanceFilter = 10;
if( Titanium.Geolocation.locationServicesEnabled === false ) {
    Ti.API.debug('Your device has GPS turned off. Please turn it on.');
}
function updatePosition(e) {
    if( ! e.success || e.error ) {
    alert("Unable to get your location.");
    Ti.API.debug(JSON.stringify(e));
    Ti.API.debug(e);
    return;
    }
    Ti.App.fireEvent("app:got.location", {
    "coords" : e.coords
    });
};

Ti.App.addEventListener("app:got.location", function(d) {
    Ti.App.GeoApp.f_lng = d.longitude;
    Ti.App.GeoApp.f_lat = d.latitude;
    Ti.API.debug(JSON.stringify(d));
    Ti.Geolocation.removeEventListener('location', updatePosition);

    alert(JSON.stringify(d));
});
Titanium.Geolocation.getCurrentPosition( updatePosition );    
Titanium.Geolocation.addEventListener( 'location', updatePosition );
运行此代码后,它会发出警报*无法在android模拟器中获取您的位置*
我错过了什么?提前感谢

您必须使用telnet连接到模拟器并“设置位置”。每次设置位置时,都会收到一个事件

` telnet localhost 5554(考虑到有时端口是不同的-您可以在窗口标题栏中看到它)

正在尝试127.0.0.1

已连接到本地主机

转义字符为“^]”

Android控制台:键入“帮助”以获取命令列表

geo fix 15.4548 12.4548(参数为经度、纬度,单位为度)

退出 `

享受