提交 924f25da 编写于 作者: 杜庆泉's avatar 杜庆泉

location page ing

上级 b3beda80
......@@ -2,8 +2,8 @@
"name" : "HelloUTS",
"appid" : "__UNI__70BE9D0",
"description" : "",
"versionName" : "1.0.5",
"versionCode" : "105",
"versionName" : "1.0.6",
"versionCode" : "106",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
......
......@@ -34,21 +34,35 @@ export function requestPremission() {
class SingleLocationListener extends TencentLocationListener {
constructor(changeListener: (res: string) => void){
super();
}
override onLocationChanged(location:TencentLocation , error:Int ,
reason:string ):Unit{
reason:string ):void{
if(error == 0){
let locationName = location.name;
let locationAddress = location.address;
let latitude = location.latitude;
let longitude = location.longitude;
}
console.log(location);
console.log(error);
console.log(reason);
}
override onStatusUpdate(name:string, status:Int, desc:string ):Unit{
override onStatusUpdate(name:string, status:Int, desc:string ):void{
console.log(name);
}
}
export function getLocation() {
export function getLocation(changeListener: (res: string) => void) {
// 获取当前的地址回调
let mLocationManager = TencentLocationManager.getInstance(getAppContext());
let mLocationListener = new SingleLocationListener();
let mLocationListener = new SingleLocationListener(changeListener);
mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper());
// 请求权限
return { name: "getLocation"};
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册