-
Notifications
You must be signed in to change notification settings - Fork 0
/
geolocation.html
40 lines (38 loc) · 1.41 KB
/
geolocation.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>DAG Sculder</title>
<link href="css/style.css" rel=stylesheet type="text/css">
<script src="js/jquery.js"></script>
<script src="phonegap.js"></script>
<script>
var watchID = null;
document.addEventListener('deviceready', loaded, false);
function loaded(){
watchID = navigator.geolocation.watchPosition(success, error, {frequency:3000});
}
function success(position) {
var element = document.getElementById('geolocation');
element.innerHTML = 'Latitiude: ' + 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' + new Date(position.timestamp) + '<hr>';
}
function error(error){
alert(error.message);
}
</script>
</head>
<body>
<h1>GeoLocation API</h1>
<a href="camera.html">Camera API</a>
<a href="index.html">Accelorometer API</a>
<div id="geolocation">Finding Geolocation...</div>
</body>
</html>