From 65a36c01c7920ba799677a7b49dd5b74d261b5d5 Mon Sep 17 00:00:00 2001 From: duqingquan Date: Tue, 6 Sep 2022 19:58:48 +0800 Subject: [PATCH] location page +1 --- pages/SDKIntegration/SDKIntegration.vue | 6 ++++-- .../uts-tencentgeolocation/utssdk/app-android/index.uts | 5 ++++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/pages/SDKIntegration/SDKIntegration.vue b/pages/SDKIntegration/SDKIntegration.vue index 1d9f2aa..9ae4b98 100644 --- a/pages/SDKIntegration/SDKIntegration.vue +++ b/pages/SDKIntegration/SDKIntegration.vue @@ -20,8 +20,10 @@ testGetlocation:function(e){ requestPremission(); - var locationRet = getLocation(); - console.log(locationRet); + var locationRet = getLocation(function(res){ + console.log(res); + }); + }, } } diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts index ba2f866..cdf856b 100644 --- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts @@ -62,7 +62,10 @@ export function getLocation(changeListener: (res: string) => void) { // 获取当前的地址回调 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()); // 请求权限 return { name: "getLocation"}; -- GitLab