diff --git a/manifest.json b/manifest.json index 9d076ea3a30e951ba174b2dba32349e973a97c90..78d09bcd3fc1ed5c92e67334647976d8e928fe44 100644 --- a/manifest.json +++ b/manifest.json @@ -2,8 +2,8 @@ "name" : "HelloUTS", "appid" : "__UNI__70BE9D0", "description" : "", - "versionName" : "1.0.1", - "versionCode" : "101", + "versionName" : "1.0.5", + "versionCode" : "105", "transformPx" : false, /* 5+App特有相关 */ "app-plus" : { diff --git a/pages/SDKIntegration/SDKIntegration.vue b/pages/SDKIntegration/SDKIntegration.vue index eb386fe8fd1935c2d72a565a593b9f7fe59abeac..1d9f2aa6ff9f5c238b6cb284050e21587fdb8485 100644 --- a/pages/SDKIntegration/SDKIntegration.vue +++ b/pages/SDKIntegration/SDKIntegration.vue @@ -1,11 +1,15 @@ diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts index aab779cc4b826ac8632eb7171cdb83e2638597be..7b157b2a371a9ea30091305a78db9695ff21ba84 100644 --- a/uni_modules/uts-advance/utssdk/app-android/index.uts +++ b/uni_modules/uts-advance/utssdk/app-android/index.uts @@ -1,5 +1,4 @@ -import { getUniActivity,getAppContext } from "io.dcloud.uts.android"; import Rect from "android.graphics.Rect"; import Color from "android.graphics.Color"; import TextView from "android.widget.TextView"; @@ -10,6 +9,17 @@ import Runnable from 'java.lang.Runnable'; import Exception from 'java.lang.Exception'; import MediaPlayer from 'android.media.MediaPlayer'; +import logo from "../../static/logo.png"; + +import { + onAppActivityDestroy, + onAppActivityPause, + onAppActivityResume, + onAppActivityBack, + getUniActivity, + getAppContext +} from "io.dcloud.uts.android"; + /** * 定时任务参数封装 */ @@ -105,15 +115,7 @@ export function removeViewToDecorView() { } -import logo from "../../static/logo.png"; -import { - onAppActivityDestroy, - onAppActivityPause, - onAppActivityResume, - onAppActivityBack, - -} from "io.dcloud.uts.android"; export function getLogoPath(): string { @@ -139,7 +141,6 @@ export function playAssetAudio() { export function initAppLifecycle(onLifecycleChange: (event:string) => void) { onAppActivityDestroy(() => { - let eventName = "onAppActivityDestroy - " + Date.now(); onLifecycleChange(eventName); console.log(eventName); diff --git a/uni_modules/uts-tencentgeolocation/changelog.md b/uni_modules/uts-tencentgeolocation/changelog.md new file mode 100644 index 0000000000000000000000000000000000000000..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 diff --git a/uni_modules/uts-tencentgeolocation/package.json b/uni_modules/uts-tencentgeolocation/package.json new file mode 100644 index 0000000000000000000000000000000000000000..07c02da0c2431f5f51a32fd7e5f83f6cd590e13d --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/package.json @@ -0,0 +1,81 @@ +{ + "id": "uts-tencentgeolocation", + "displayName": "uts-tencentgeolocation", + "version": "1.0.0", + "description": "uts-tencentgeolocation", + "keywords": [ + "uts-tencentgeolocation" +], + "repository": "", + "engines": { + "HBuilderX": "^3.6.0" + }, + "dcloudext": { + "type": "uts", + "sale": { + "regular": { + "price": "0.00" + }, + "sourcecode": { + "price": "0.00" + } + }, + "contact": { + "qq": "" + }, + "declaration": { + "ads": "", + "data": "", + "permissions": "" + }, + "npmurl": "" + }, + "uni_modules": { + "dependencies": [], + "encrypt": [], + "platforms": { + "cloud": { + "tcb": "u", + "aliyun": "u" + }, + "client": { + "Vue": { + "vue2": "n", + "vue3": "y" + }, + "App": { + "app-android": "u", + "app-ios": "u" + }, + "H5-mobile": { + "Safari": "u", + "Android Browser": "u", + "微信浏览器(Android)": "u", + "QQ浏览器(Android)": "u" + }, + "H5-pc": { + "Chrome": "u", + "IE": "u", + "Edge": "u", + "Firefox": "u", + "Safari": "u" + }, + "小程序": { + "微信": "u", + "阿里": "u", + "百度": "u", + "字节跳动": "u", + "QQ": "u", + "钉钉": "u", + "快手": "u", + "飞书": "u", + "京东": "u" + }, + "快应用": { + "华为": "u", + "联盟": "u" + } + } + } + } +} \ No newline at end of file diff --git a/uni_modules/uts-tencentgeolocation/readme.md b/uni_modules/uts-tencentgeolocation/readme.md new file mode 100644 index 0000000000000000000000000000000000000000..45782f0d21316a19fe28b4254952a4c7f9da30d0 --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/readme.md @@ -0,0 +1,5 @@ +# uts-tencentgeolocation +### 开发文档 +[UTS 语法](https://uniapp.dcloud.net.cn/tutorial/syntax-uts.html) +[UTS 原生插件](https://uniapp.dcloud.net.cn/plugin/uts-plugin.html) +[Hello UTS](https://gitcode.net/dcloud/hello-uts/-/tree/dev) \ No newline at end of file diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml b/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..e3b8eb584d9a7be6afa45d6b01bc811d35b20b3c --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml @@ -0,0 +1,34 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json b/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json new file mode 100644 index 0000000000000000000000000000000000000000..99bddc8f8c93a544554d5c67461c7933ea7f9348 --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json @@ -0,0 +1,11 @@ +{ + "libs": [], + "dependencies": [{ + "id": "androidx.core:core", + "source": "implementation 'androidx.core:core:1.0.0'" + }, { + "id": "com.tencent.map.geolocation:TencentLocationSdk-openplatform", + "source": "implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.3.0'" + }], + "minSdkVersion": 21 +} diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts new file mode 100644 index 0000000000000000000000000000000000000000..0ed35a39af40a5441348112a3a09a5dda0b86272 --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts @@ -0,0 +1,55 @@ +import { + onAppActivityPause, + onAppActivityRequestPermissionsResult, + getUniActivity, + getAppContext +} from "io.dcloud.uts.android"; + +import ActivityCompat from "androidx.core.app.ActivityCompat"; +import Manifest from "android.Manifest"; +import Looper from "android.os.Looper"; +import TencentLocationManager from "com.tencent.map.geolocation.TencentLocationManager"; +import TencentLocationListener from "com.tencent.map.geolocation.TencentLocationListener"; +import TencentLocation from "com.tencent.map.geolocation.TencentLocation"; + +export function requestPremission() { + + // 注册一个请求回调 + // onAppActivityRequestPermissionsResult((requestCode: number, + // permissions: Array, + // grantResults: Array) => { + // let eventName = "onAppActivityRequestPermissionsResult - " + Date.now(); + // console.log(eventName); + // }); + //发起权限申请 + // let permissions:string[] = [Manifest.permission.ACCESS_COARSE_LOCATION] + ActivityCompat.requestPermissions( + getUniActivity()!, + arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION), 1001); + + // 请求权限 + return { name: "requestPremission"}; +} + + +class SingleLocationListener extends TencentLocationListener { + + override onLocationChanged(location:TencentLocation , error:Int , + reason:string ):Unit{ + console.log(location); + } + + override onStatusUpdate(name:string, status:Int, desc:string ):Unit{ + console.log(name); + } +} + +export function getLocation() { + + // 获取当前的地址回调 + let mLocationManager = TencentLocationManager.getInstance(getAppContext()); + let mLocationListener = new SingleLocationListener(); + mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper()); + // 请求权限 + return { name: "getLocation"}; +} \ No newline at end of file diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar b/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar new file mode 100644 index 0000000000000000000000000000000000000000..afaf663efad2fe8be5d9ef17cbb9351291a5029a Binary files /dev/null and b/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/TencentLocationSDK-v7.4.9.jar differ diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0.jar b/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0.jar new file mode 100644 index 0000000000000000000000000000000000000000..f1f7e720871192c61a9faa138c03ea78bb8efb8b Binary files /dev/null and b/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0.jar differ diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/proguard-rules.pro b/uni_modules/uts-tencentgeolocation/utssdk/app-android/proguard-rules.pro new file mode 100644 index 0000000000000000000000000000000000000000..4a393a659f17e79a56761d79d4bbafd4c390ffbd --- /dev/null +++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/proguard-rules.pro @@ -0,0 +1,17 @@ +-keepattributes *Annotation* +-keepclassmembers class ** { + public void on*Event(...); +} +-keep public class com.tencent.location.**{ + public protected *; +} +-keepclasseswithmembernames class * { + native ; +} +-keep class c.t.**{*;} +-keep class com.tencent.map.geolocation.**{*;} +-dontwarn org.eclipse.jdt.annotation.** +-dontwarn c.t.** +-dontwarn android.location.Location +-dontwarn android.net.wifi.WifiManager +-dontnote ct.**