0
내 애플 리케이션에서 장치의 위치를 얻으려고합니다. 위치 서비스가있는 경우 앱이 정상적으로 작동합니다. 그러나 위치 서비스가 android에있는 경우 위치 서비스가 꺼져 있고 주소를 입력하라는 메시지가 앱에 표시되기를 원합니다. 내 코드이 코드는하지만 안드로이드 장치에서 로컬 컴퓨터 크롬에서 일하고안드로이드 webview 위치 리디렉션
if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(init_pos,showerror);
}
else {
window.open("Location.aspx", '_self', location = true);
}
function showerror(error) {
switch (error.code) {
case error.PERMISSION_DENIED:
window.open("Location.aspx", '_self', location = true);
break;
case error.POSITION_UNAVAILABLE:
window.open("Location.aspx", '_self', location = true);
break;
case error.TIMEOUT:
window.open("Location.aspx", '_self', location = true);
break;
case error.UNKNOWN_ERROR:
window.open("Location.aspx", '_self', location = true);
break;
}
}
}
function init_pos(position) {
lat = position.coords.latitude;
long = position.coords.longitude;
window.open("home1.aspx?lat=" + lat + "&lng=" + long, '_self', location = true);
}
입니다.