|
android
IOS还没有测试,一个个搞定吧
首先,这个KEY是没有问题的,以前引用的baiduMap是正常的
<feature name="bMap">
<param name="android_api_key" value="cmW3lYIljl9NxyfrlglEMhln"/>
<param name="ios_api_key" value="wTp9fChSUlct5VprBpQey8UH"/>
</feature>
代码如下:
var map = api.require('bMap');
map.getLocation({
accuracy: '10m',
filter:1,
autoStop: true
}, function(ret, err){
if(ret.status){
var location = $my.getLocation();
location.lat = ret.latitude;
location.lon = ret.longitude;
location.time = ret.timestamp;
$my.setLocation(location);
map.setCenter({
coords: {
lon: ret.longitude,
lat: ret.latitude
},
animation:false
});
map.setZoomLevel({
level:15
});
} else {
api.alert({msg: JSON.stringify(err) + JSON.stringify(ret)});
}
map.stopLocation();
}); |
|