45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
/**
|
|
* 获取手机上的信息,比如位置,手机ID
|
|
* @author yinjihuan
|
|
*/
|
|
//扩展API加载完毕后调用onPlusReady回调函数
|
|
document.addEventListener('plusready', onPlusReady, false);
|
|
//扩展API加载完毕,现在可以正常调用扩展API
|
|
function onPlusReady(){
|
|
getPosition();
|
|
}
|
|
var province = "";
|
|
var city = "";
|
|
var region = "";
|
|
|
|
// 获取当前用户位置
|
|
function getPosition(){
|
|
plus.geolocation.getCurrentPosition(function(p){
|
|
province = p.address.province;
|
|
city = p.address.city;
|
|
region = p.address.district;
|
|
}, function(e){
|
|
|
|
},
|
|
{
|
|
provider:'baidu',
|
|
enableHighAccuracy:true,
|
|
coordsType:'bd09ll'
|
|
}
|
|
);
|
|
}
|
|
|
|
function getPushInfo(){
|
|
try {
|
|
var info = plus.push.getClientInfo();
|
|
return info.clientid;
|
|
}catch(error) {
|
|
console.log( error);
|
|
}
|
|
// console.log( "获取客户端推送标识信息:" );
|
|
// console.log( "token: "+info.token );
|
|
// alert( "clientid: "+info.clientid );
|
|
// console.log( "appid: "+info.appid );
|
|
// console.log( "appkey: "+info.appkey );
|
|
return "";
|
|
} |