百度地图配置了密钥已经可以使用定位功能,但是地图不显示怎么回事啊?真机直接运行是没问题的
<script type="text/javascript">
var ws = null,
wo = null;
var em = null,
mapbox = null;
// H5 plus事件处理
function plusReady() {
if (localStorage.punch == '0')
navMapTop.childNodes.item(1).className = 'active';
else
navMapTop.childNodes.item(2).className = 'active';
if (!em || ws) {
return
};
// 获取窗口对象
ws = plus.webview.currentWebview();
wo = ws.opener();
setTimeout(function() {
mapbox = new plus.maps.Map("map");
userLocation();
}, 300);
}
if (window.plus) {
plusReady();
} else {
document.addEventListener("plusready", plusReady, false);
}
// DOMContentloaded事件处理
document.addEventListener("DOMContentLoaded", function() {
em = document.getElementById("map");
window.plus && plusReady();
}, false);
function userLocation() {
var w = plus.nativeUI.showWaiting(" 定位中... \n");
// 通知结果方法
function locationCallback( state, point ) {
w.close();
if (0 == state) {
buttonq.style.background = '#F68806';
buttonq.setAttribute('onclick', "clicked('registration.html')");
localStorage.lat = point.getLat();
localStorage.lng = point.getLng();
setTimeout(function() {
var center = new plus.maps.Point(point.getLng(), point.getLat());
mapbox.centerAndZoom(center, 16);
createMarker();
}, 300);
mapbox.setCenter(point);
} else {
alert( "无法获取当前位置" );
}
}
// 获取用户位置信息
mapbox.getUserLocation(locationCallback);
mapbox.showUserLocation(true);
}
function createMarker() {
var mappnt = new ajax({
url: "/Api/Index/place",
send: "tocken=" + localStorage.tocken,
success: function(data, test) {
if (data['status'] == 1) {
for (i in data['data']) {
var marker = new plus.maps.Marker(new plus.maps.Point(data['data'][i]['lng'], data['data'][i]['lat']));
marker.setLabel(data['data'][i]['place_name']);
marker.setBubble(new plus.maps.Bubble(data['data'][i]['place_name']));
marker.setIcon('img/mapicon.png');
mapbox.addOverlay(marker);
}
} else {
plus.nativeUI.toast(data['data']);
}
}
});
mapbox.onclick = function(marker) {
alert("Clicked:" + marker.getLabel());
}
}
function sendback() {
back();
}
</script>
Gavin (作者)
安卓平台上的
2014-10-10 14:00
Gavin (作者)
谢谢您的回答。但是安卓上的还是不行怎么搞?????
2014-10-10 14:21
Gavin (作者)
HBuilder默认App云端打包默认使用的是DCloud共用证书,其信息如下:
MD5: 59:20:1C:F6:58:92:02:CB:2C:DA:B2:67:52:47:21:12
SHA1:BA:AD:09:3A:82:82:9F:B4:32:A7:B2:8C:B4:CC:F0:E9:F3:7D:AE:58 这个重新申请密钥了也不行???
签名证书KeyStore下载
证书别名:hbuilder
证书密码:123456
keystore密码:123456
用这个默认的打包也不行???
2014-10-10 14:25
DCloud_App_Array
在百度地图LBS开放平台申请应用配置的安全码正确吗?
使用DCloud公用证书格式为:
BA:AD:09:3A:82:82:9F:B4:32:A7:B2:8C:B4:CC:F0:E9:F3:7D:AE:58;%PackageName%
如:
BA:AD:09:3A:82:82:9F:B4:32:A7:B2:8C:B4:CC:F0:E9:F3:7D:AE:58;io.dcloud.Research
2014-10-10 14:59
Gavin (作者)
用公用打包就好了 和用这个BA:AD:09:3A:82:82:9F:B4:32:A7:B2:8C:B4:CC:F0:E9:F3:7D:AE:58 申请密钥 就好了谢谢
2014-10-10 15:51