要知道的位置的 phonegap GeoLocation 值

phonegap GeoLocation values for location to know

我的程序运行正常,给出了正确的纬度和经度值。

但问题是我如何向客户表明他来自这个 LOCATION。

我阅读了 phonegap GeoLocation documentation 我没有找到任何解决方案。他们有关于如何从那里获取价值的文献API GeoLocation

添加这个脚本

<script src="http://maps.googleapis.com/maps/api/js?sensor=false&amp;libraries=places" type="text/javascript"></script>

并尝试使用它,

navigator.geolocation.getCurrentPosition(function(position) {

lat = position.coords.latitude;
lng = position.coords.longitude;
var geocoder;
geocoder = new google.maps.Geocoder();
var latlng = new google.maps.LatLng(lat, lng);

geocoder.geocode({
        'latLng': latlng
    },
    function(results, status) {
        if (status == google.maps.GeocoderStatus.OK) {
            if (results[0]) {
                var add = results[0].formatted_address;
                var value = add.split(",");

                count = value.length;
                country = value[count - 1];
                state = value[count - 2];
                city = value[count - 3];
                alert("city name is: " + city);
            } else {
                alert("address not found");
            }
        } else {
            alert("Geocoder failed due to: " + status);
        }
    }
);

});

对于 phonegap Geolocation API 请 whitelist google api whisch 在 config.xmlandroid.manifest.xml 中的 access 也看看这个 solution at Whosebug for phonegap Maps 也按照dhruv的回答。