native_LBS.js
889 Bytes
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
var Coordinates = function(lat, lng) {
/**
* The latitude of the position.
*/
this.latitude = lat;
/**
* The longitude of the position,
*/
this.longitude = lng;
};
var Placemark = function(p) {
// 国家
this.country = p["Country"];
// 国家代号
this.countryCode = p["CountryCode"];
// 城市
this.city = p["City"];
// 省
this.state = p["State"];
// 街道
this.street = p["Street"];
// 区
this.sublocality = p["SubLocality"];
// 完整地址名称
this.name = p["Name"];
};
function native_LBS_callbackWithInfo(result, onSuccess, action) {
if (action === "getLocation") {
var c = new Coordinates(result["latitude"], result["longitude"]);
onSuccess(c);
} else if (action === "getLocationDetail") {
var c = new Placemark(result);
onSuccess(c);
}
}