HTML5 + PhoneGap에서 작동 중입니다. 내 응용 프로그램에서 나는 위도와 경도를 얻으려면 위약 처지 Geolocation이 필요합니다.PhoneGAP Geoloaction이 Android에서 작동하지 않습니다.
document.addEventListener("deviceready", onDeviceReady, false);
// Cordova is ready
//
function onDeviceReady() {
alert('deviceready');
//navigator.geolocation.getCurrentPosition(onSuccess, onError);
navigator.geolocation.getCurrentPosition(onSuccess);
}
// onSuccess Geolocation
//
function onSuccess(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitude: ' + position.coords.latitude + '<br />' +
'Longitude: ' + position.coords.longitude + '<br />' +
'Altitude: ' + position.coords.altitude + '<br />' +
'Accuracy: ' + position.coords.accuracy + '<br />' +
'Altitude Accuracy: ' + position.coords.altitudeAccuracy + '<br />' +
'Heading: ' + position.coords.heading + '<br />' +
'Speed: ' + position.coords.speed + '<br />' +
'Timestamp: ' + position.timestamp + '<br />';
}
// onError Callback receives a PositionError object
//
function onError(error) {
alert('code: ' + error.code + '\n' +
'message: ' + error.message + '\n');
}
그러나 그것이 작동하지에서 예제 코드를 가지고 검색 할 때! 항상 표시 지오 로케이션을보고 ...하지만 세부 정보가로드되지 않습니다. 이 문제를 검색 한 결과 올바른 해결 방법을 얻지 못했습니다.
나는 같은 문제가 여기에 게시하지만 솔루션 내가 위도의 세부 정보와 경도 정보가 폰갭을 사용하여 얻을 수있는 방법이 :(
에서 워킹되지 않는 것을 발견?
아무도 나를 도와 드릴까요 ???
네 navigator.geolocation.getCurrentPosition (onSuccess, onError, {enableHighAccuracy : true})을 시도했습니다. 하지만 아직 작동하지 않습니다 : ( –