Google maps Android Emulator-如何获取地理位置?

Google maps Android Emulator-如何获取地理位置?,google-maps,android-emulator,jquery-mobile,Google Maps,Android Emulator,Jquery Mobile,我正在为android应用程序使用“jquery ui地图”。我的模拟器是谷歌API 13级3.2版。我的Javascript代码是: $('#gps_map').live("pageshow", function() { $('#map_canvas_2').gmap('refresh'); $('#map_canvas_2').gmap('getCurrentPosition', function(position, status) { if ( status === 'OK' )

我正在为android应用程序使用“jquery ui地图”。我的模拟器是谷歌API 13级3.2版。我的Javascript代码是:

$('#gps_map').live("pageshow", function() {
$('#map_canvas_2').gmap('refresh');
$('#map_canvas_2').gmap('getCurrentPosition', function(position, status) {
    if ( status === 'OK' ) {
        var latlng = new google.maps.LatLng(position.coords.latitude, position.coords.longitude)
        $('#map_canvas_2').gmap('get', 'map').panTo(latlng);
        $('#map_canvas_2').gmap('search', { 'location': latlng }, function(results, status) {
            if ( status === 'OK' ) {
                $('#from').val(results[0].formatted_address);
            }
        });
    } else {
        alert('Unable to get current position');
    }
});});

此代码始终无法获取位置。我在模拟器中看不到GPS图标。我尝试设置所有可能的权限,尝试使用geo-fix方法设置latlong坐标,但没有任何效果。有什么方法可以让地理定位在android上工作吗?

终于找到了答案

$('#map_canvas').gmap('getCurrentPosition', function(pos, status) {
        if (status === "OK") {
            var latLng = new google.maps.LatLng(pos.coords.latitude,pos.coords.longitude);
            $('#map_canvas').gmap('option', 'center', latLng);
        } else {
            // error msg
        }
    }, { timeout: 10000, enableHighAccuracy: true} );

在选项中添加更长的超时,如上图所示,可以解决此问题。该示例显示了一个长超时:10秒

好了,忘了“jquery ui地图”吧,你能告诉我在模拟器中正确处理GPS位置吗?