diff --git a/manifest.json b/manifest.json index 78d09bcd3fc1ed5c92e67334647976d8e928fe44..492471d525ccbcaea0159056347515ae954ceb27 100644 --- a/manifest.json +++ b/manifest.json @@ -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" : { diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts index 0ed35a39af40a5441348112a3a09a5dda0b86272..ba2f8662a5cba7b64c88a26b1b82ec5d782c231e 100644 --- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts @@ -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"};