diff --git a/AndroidManifest.xml b/AndroidManifest.xml
new file mode 100644
index 0000000000000000000000000000000000000000..81d2140cb5f010c3566ddb18e942cea337a25bc0
--- /dev/null
+++ b/AndroidManifest.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
+
+
+
+
diff --git a/manifest.json b/manifest.json
index 0e88621fae9c4c2dd0d1f5f06d7237dbbed61248..5511eaec45f3c6a8f2d2835c77281c3a03bcd878 100644
--- a/manifest.json
+++ b/manifest.json
@@ -2,8 +2,8 @@
"name" : "HelloUTS",
"appid" : "__UNI__70BE9D0",
"description" : "",
- "versionName" : "1.0.8",
- "versionCode" : "108",
+ "versionName" : "1.0.9",
+ "versionCode" : "109",
"transformPx" : false,
/* 5+App特有相关 */
"app-plus" : {
diff --git a/pages/advance/advance.vue b/pages/advance/advance.vue
index 69c3c4f679c0d6ff5bc2882a25a2bfab8b926e12..40f1a18d06cfb897a37cc62c7bd1b088394e47e5 100644
--- a/pages/advance/advance.vue
+++ b/pages/advance/advance.vue
@@ -14,7 +14,7 @@
-
+
@@ -38,9 +38,11 @@
taskId:0
}
},
- onUnload:function(){
- },
+
methods: {
+ /**
+ * 测试延迟任务
+ */
testTimer: function () {
doTimerTask({
start:function(response){
@@ -57,6 +59,9 @@
},
});
},
+ /**
+ * 测试周期任务
+ */
testInterval: function () {
var ret = doIntervalTask({
start:function(response){
@@ -74,21 +79,31 @@
});
this.taskId = ret.taskId;
},
-
+ /**
+ * 取消周期任务
+ */
testClearInterval: function () {
console.log(this.taskId);
clearIntervalTask(this.taskId);
},
+ /**
+ * 测试添加View实例至顶层容器
+ */
testAddToDecorView: function () {
addViewToDecorView();
},
-
+ /**
+ * 测试移除顶层容器的View实例
+ */
testRemoveToDecorView: function () {
removeViewToDecorView();
},
- testResource: function () {
+ /**
+ * 跳转至资源加载演示界面
+ */
+ gotoResourceDemo: function () {
uni.navigateTo({
url:'/pages/resource/resource'
})
diff --git a/pages/index/index.vue b/pages/index/index.vue
index 2f33e23fe71be05fe8bccbd52a88b69142092c57..1832e83b4d4cf33f247ba4200dc3e0cdac16f32e 100644
--- a/pages/index/index.vue
+++ b/pages/index/index.vue
@@ -19,9 +19,12 @@
stringParam:"hello world",
}
},
- onUnload:function(){
- },
+
methods: {
+
+ /**
+ * 测试无参数调用
+ */
testDoSthWithCallback: function () {
UTSHello.callWithoutParam(
@@ -33,7 +36,11 @@
}
);
},
+ /**
+ * 测试字符串参数回调
+ */
testDoSthWithString: function () {
+
UTSHello.callWithStringParam(
this.stringParam,
function(response){
@@ -44,6 +51,9 @@
},
);
},
+ /**
+ * 测试json参数回调
+ */
testDoSthWithJSON: function () {
var inputObject = {
inputText:this.stringParam
diff --git a/uni_modules/uts-advance/utssdk/app-android/config.json b/uni_modules/uts-advance/utssdk/app-android/config.json
deleted file mode 100644
index 7a73a41bfdf76d6f793007240d80983a52f15f97..0000000000000000000000000000000000000000
--- a/uni_modules/uts-advance/utssdk/app-android/config.json
+++ /dev/null
@@ -1,2 +0,0 @@
-{
-}
\ No newline at end of file
diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts
index 7b157b2a371a9ea30091305a78db9695ff21ba84..7ba747dadfdf7ebc60a6b172cb2322f7f8bf564d 100644
--- a/uni_modules/uts-advance/utssdk/app-android/index.uts
+++ b/uni_modules/uts-advance/utssdk/app-android/index.uts
@@ -20,12 +20,21 @@ import {
getAppContext
} from "io.dcloud.uts.android";
+
/**
* 定时任务参数封装
*/
type TimerOptions = {
- start: (res: string) => void;
- work: (res: string) => void;
+ /**
+ * 定时任务开始的回调
+ * @res 回调参数
+ */
+ start: (res: string) => void;
+ /**
+ * 定时任务执行的回调
+ * @res 回调参数
+ */
+ work: (res: string) => void;
};
@@ -60,12 +69,14 @@ export function doIntervalTask(opts:TimerOptions) {
export function clearIntervalTask(taskId:number) {
clearInterval(taskId);
-
- return { name: "clearIntervalTask"};
+ return { name: "clearIntervalTask"};
}
-
+/**
+ * 实现一个添加view的 Runnable类
+ * 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB
+ */
class AddUIRunnable extends Runnable {
override run():void {
@@ -89,6 +100,10 @@ class AddUIRunnable extends Runnable {
}
};
+/**
+ * 实现一个移除view的 Runnable类
+ * 用法说明:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#%E5%8C%BF%E5%90%8D%E5%86%85%E9%83%A8%E7%B1%BB
+ */
class RemoveUIRunnable extends Runnable {
override run():void {
@@ -102,27 +117,34 @@ class RemoveUIRunnable extends Runnable {
}
};
-
+/**
+ * 实现添加view实例至decorview
+ *
+ */
export function addViewToDecorView() {
let uiRunable = new AddUIRunnable();
getUniActivity()!.runOnUiThread(uiRunable)
}
-
+/**
+ * 实现从decorview上移除指定view
+ */
export function removeViewToDecorView() {
var uiRunable = new RemoveUIRunnable();
getUniActivity()!.runOnUiThread(uiRunable)
}
-
-
-
+/**
+ * 引用资源路径
+ */
export function getLogoPath(): string {
return logo;
}
-
+/**
+ * 播放asset资源中的音频
+ */
export function playAssetAudio() {
let assetManager = getAppContext()!.getAssets();
@@ -135,26 +157,43 @@ export function playAssetAudio() {
}
-
-
-
+/**
+ * 初始化应用生命周期监听
+ *
+ */
export function initAppLifecycle(onLifecycleChange: (event:string) => void) {
+ /**
+ * activity 销毁生命周期回调
+ * 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivitydestroy
+ */
onAppActivityDestroy(() => {
let eventName = "onAppActivityDestroy - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
+ /**
+ * activity 失去焦点生命周期回调
+ * 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivitypause
+ */
onAppActivityPause(() => {
let eventName = "onAppActivityPause - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
+ /**
+ * activity 得到焦点的周期回调
+ * 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivityresume
+ */
onAppActivityResume(() => {
let eventName = "onAppActivityResume - " + Date.now();
onLifecycleChange(eventName);
console.log(eventName);
});
+ /**
+ * activity 回退物理按键事件回调
+ * 说明文档:https://uniapp.dcloud.net.cn/plugin/uts-plugin.html#onappactivityback
+ */
onAppActivityBack(() => {
let eventName = "onAppActivityBack - " + Date.now();
onLifecycleChange(eventName);
diff --git a/uni_modules/uts-advance/utssdk/app-android/utils.uts b/uni_modules/uts-advance/utssdk/app-android/utils.uts
deleted file mode 100644
index 71050f559311b3e39bb37491b1ff8018910f6214..0000000000000000000000000000000000000000
--- a/uni_modules/uts-advance/utssdk/app-android/utils.uts
+++ /dev/null
@@ -1,3 +0,0 @@
-export function log(msg: string) {
- console.log(msg);
-}
diff --git a/uni_modules/uts-helloworld/utssdk/app-android/index.uts b/uni_modules/uts-helloworld/utssdk/app-android/index.uts
index e6681005d445c88f8b0906905bb227553578ce4f..e42147d6364ff99715cf8cf1530f0f5342dfb082 100644
--- a/uni_modules/uts-helloworld/utssdk/app-android/index.uts
+++ b/uni_modules/uts-helloworld/utssdk/app-android/index.uts
@@ -1,9 +1,13 @@
-
+/**
+ * json参数格式定义
+ */
type inputJSON = {
inputText: string,
errCode: number
}
-
+/**
+ * json入参格式
+ */
type JsonParamOptions = {
input: inputJSON;
success: (res: string) => void;
@@ -13,7 +17,7 @@ type JsonParamOptions = {
/**
- * 导出一个带callback的同步方法
+ * 导出无参的UTS函数
* @param opts
*/
export function callWithoutParam(success: () => void) {
@@ -21,13 +25,17 @@ export function callWithoutParam(success: () => void) {
return { name: "doSthWithCallback" };
}
-
+/**
+ * 导出一个字符串入参的UTS函数
+ */
export function callWithStringParam(input: string, success: (res: string) => void) {
success(input);
return { name: "doSthWithCallback" };
}
-
+/**
+ * 导出一个JSON入参的UTS函数
+ */
export function callWithJSONParam(opts: JsonParamOptions) {
opts.input.errCode = 10;
opts.success(opts.input);
diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml b/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
index 153ef60237496302710119561e8e44a5dab0088f..bb210514e93a009f73aae35936c0ee837cffb786 100644
--- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
+++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/AndroidManifest.xml
@@ -26,9 +26,5 @@
-
-
-
-
-
+
diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json b/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
index ba5d885e04ed80dcac7ddf112739b77349850623..47c811901d2609ea81d51b2d0ba5752567eb6077 100644
--- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
+++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/config.json
@@ -1,8 +1,3 @@
{
- "dependencies": [
- {
- "id": "com.tencent.map.geolocation:TencentLocationSdk-openplatform",
- "source": "implementation 'com.tencent.map.geolocation:TencentLocationSdk-openplatform:7.4.9'"
- }],
"minSdkVersion": 21
}
diff --git a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
index bcc78cc146e950c030ffcf5562a0d50f4a2395db..8115b87785f2cb387f5b13f21253dc9545c4ab89 100644
--- a/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
+++ b/uni_modules/uts-tencentgeolocation/utssdk/app-android/index.uts
@@ -16,6 +16,12 @@ import TencentLocationRequest from "com.tencent.map.geolocation.TencentLocationR
export function requestPremission() {
+ /**
+ * 同意隐私协议。重要!!
+ * 说明文档:https://lbs.qq.com/mobile/androidLocationSDK/androidGeoGuide/agreePrivacy
+ */
+ TencentLocationManager.setUserAgreePrivacy(true);
+
// 注册一个请求回调
onAppActivityRequestPermissionsResult((requestCode: number,
permissions: MutableList,
@@ -28,8 +34,8 @@ export function requestPremission() {
console.log(permissions);
console.log(requestCode);
});
- // 发起权限申请
+ // 发起权限申请
ActivityCompat.requestPermissions(
getUniActivity()!,
arrayOf(Manifest.permission.ACCESS_COARSE_LOCATION,Manifest.permission.ACCESS_FINE_LOCATION), 1001);
@@ -57,6 +63,10 @@ type LocationResponse = {
longitude?:number
}
+
+/**
+ * 定位监听结果包装类
+ */
class LocationOptionsWapper{
hostOption:LocationOptions;
@@ -101,7 +111,7 @@ class SingleLocationListener extends TencentLocationListener {
reason:string ):void{
console.log(error);
console.log(reason);
- console.log(location);
+ console.log(error);
this.hostOptionWraper.onLocationChanged(location,error,reason);
}
@@ -118,6 +128,7 @@ class SingleLocationListener extends TencentLocationListener {
*/
export function getLocation(locationOptions: LocationOptions) {
+
let mLocationManager = TencentLocationManager.getInstance(getAppContext());
// 定位监听器封装
let locationOptionWrapper = new LocationOptionsWapper(locationOptions);
@@ -130,7 +141,8 @@ export function getLocation(locationOptions: LocationOptions) {
}else{
locationRequest.setRequestLevel(TencentLocationRequest.REQUEST_LEVEL_GEO);
}
-console.log(locationRequest);
- mLocationManager.requestSingleFreshLocation(null, mLocationListener, Looper.getMainLooper());
+
+ mLocationManager.requestSingleFreshLocation(locationRequest, mLocationListener, Looper.getMainLooper());
+
return { name: "getLocation"};
}
\ No newline at end of file
diff --git "a/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-\350\207\252\345\256\232\344\271\211\345\237\272\345\272\247\351\234\200\347\247\273\351\231\244.jar" "b/uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-\350\207\252\345\256\232\344\271\211\345\237\272\345\272\247\346\227\266\347\247\273\351\231\244.jar"
similarity index 100%
rename from "uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-\350\207\252\345\256\232\344\271\211\345\237\272\345\272\247\351\234\200\347\247\273\351\231\244.jar"
rename to "uni_modules/uts-tencentgeolocation/utssdk/app-android/libs/androix-core-1.0.0-\350\207\252\345\256\232\344\271\211\345\237\272\345\272\247\346\227\266\347\247\273\351\231\244.jar"