版权声明:本文为博主原创文章,未经博主允许不得转载。 https://blog.csdn.net/RunForMyLife/article/details/78016262
1.在地图插件中,打开百度地图,根据传入的参数直接进入导航页面
在点击标注的监听回调中,添加如下方法:
点击标注的回调中,markerId是addMark的时候,第一个参数的值。
uexBaiduMap.onMarkerBubbleClickListener = function (markerId) {
var curDescr = allDataObj[markerId];
if (!curDescr ) {
return;
}
if (uexWidgetOne.platformName && uexWidgetOne.platformName === "iOS") {
var dirUrl = "baidumap://map/direction?origin=" + mylocation.latitudeValue + "," + mylocation.longitudeValue
+ "&destination=" + curDescr .latitudeValue + "," + curDescr .longitudeValue + "&mode=driving&src=corname";
uexWidget.loadApp(dirUrl, null, null);
} else {
var main = "android.intent.action.VIEW";
var add = '{"data":{"scheme":"bdapp://map/direction?destination=' + curDescr .latitudeValue + "," + curDescr .longitudeValue + '&src=baidu|corname#Intent;scheme=bdapp;package=com.baidu.BaiduMap;end"}}';
uexWidget.startApp(1, main, add);
}
};
appcan的uexBaiduMap 的插件
getCurrentLocation的方法 在页面中只能执行一次就不会在执行了。 至少不会进入他的回调函数 cbCurrentLocation中。
为了能在插件的地图页面使用刷新功能,在页面加载的时候注册 onReceiveLocation开始定位后的监听方法
该方法每隔一段时间会返回获取的当前定位的data(包含经纬度信息),可以在该监听方法中,去重新设置地图中心点,达到刷新中心位置的效果