提交 65a36c01 编写于 作者: 杜庆泉's avatar 杜庆泉

location page +1

上级 924f25da
...@@ -20,8 +20,10 @@ ...@@ -20,8 +20,10 @@
testGetlocation:function(e){ testGetlocation:function(e){
requestPremission(); requestPremission();
var locationRet = getLocation(); var locationRet = getLocation(function(res){
console.log(locationRet); console.log(res);
});
}, },
} }
} }
......
...@@ -62,7 +62,10 @@ export function getLocation(changeListener: (res: string) => void) { ...@@ -62,7 +62,10 @@ export function getLocation(changeListener: (res: string) => void) {
// 获取当前的地址回调 // 获取当前的地址回调
let mLocationManager = TencentLocationManager.getInstance(getAppContext()); let mLocationManager = TencentLocationManager.getInstance(getAppContext());
let mLocationListener = new SingleLocationListener(changeListener);
let mLocationListener = new SingleLocationListener( function(newRes:string){
changeListener(newRes);
});
mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper()); mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper());
// 请求权限 // 请求权限
return { name: "getLocation"}; return { name: "getLocation"};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册