diff --git a/pages/SyntaxCase/utsAndroid.uvue b/pages/SyntaxCase/utsAndroid.uvue
index 96ccc8bde6264c7420173dcae4472b9a1cdbd6dd..186789087373471a5638083d8d7de5534962d386 100644
--- a/pages/SyntaxCase/utsAndroid.uvue
+++ b/pages/SyntaxCase/utsAndroid.uvue
@@ -1,8 +1,6 @@
-
-
逐一点击执行,观察测试反馈
@@ -19,7 +17,6 @@
-
1. 当前页面已通过initAppLifecycle函数注册了生命周期监听。
@@ -44,299 +41,343 @@
-
-
-
-
- 点击注册activity 回调方法后,可以手动切换其他APP再返回,可在控制台和界面观察事件日志
-
+
+
+
+
+ 点击注册activity 回调方法后,可以手动切换其他APP再返回,可在控制台和界面观察事件日志
-
-
- {{ cbText }}
-
+
+
+
+ {{ cbText }}
-
-
-
-
+
+
-
-
+ .testButton {
+ width: 100%;
+ }
+
\ No newline at end of file
diff --git a/uni_modules/uts-platform-api/utssdk/app-android/index.uts b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
index 780ad79f6b977cdcdbeef2c8afa8a9c0609c553f..9d7d941c2e4134db27fdc628798869cb5448c58a 100644
--- a/uni_modules/uts-platform-api/utssdk/app-android/index.uts
+++ b/uni_modules/uts-platform-api/utssdk/app-android/index.uts
@@ -83,18 +83,23 @@ export function privacyStateTest(callback : (ret : boolean, desc : string) => vo
export function privacyStateCallBackTest(callback : (ret : boolean, desc : string) => void) {
let isAgree : boolean = true
- const cb = (ret : boolean) => {
- console.log('privacyStateCallBackTest->' + ret)
- if (ret == isAgree) {
+ const cb = (ret : PrivacyOption) => {
+ console.log('privacyStateCallBackTest->' + ret.isAgree)
+ if (ret.isAgree == isAgree) {
callback(true, "pass")
} else {
callback(false, "callback error")
}
}
// 先重置用户同意状态
- const callBackId=UTSAndroid.registerPrivacyAgreeListener(cb)
+ UTSAndroid.onPrivacyAgreeChange(cb)
UTSAndroid.setPrivacyAgree(isAgree)
- UTSAndroid.unRegisterPrivacyAgreeListener(callBackId)
+ UTSAndroid.offPrivacyAgreeChange(cb)
+ setTimeout(function () {
+ console.log('privacyStateCallBackTest->false')
+
+ UTSAndroid.setPrivacyAgree(false)
+ }, 5000);
}
/**
diff --git a/uni_modules/uts-syntaxcase/utssdk/index.uts b/uni_modules/uts-syntaxcase/utssdk/index.uts
index 6d9fc43ada89184af9ad2eeb8700ec90fcbcfefc..3e206dcb6276a01fbd2ca9d1b2b5e51d980043dc 100644
--- a/uni_modules/uts-syntaxcase/utssdk/index.uts
+++ b/uni_modules/uts-syntaxcase/utssdk/index.uts
@@ -178,32 +178,10 @@ import ActionMode from 'android.view.ActionMode';
// export let onCallBackChange: (event: string) => void = (res) => {};
let callback : (eventLog : string) => void = (res) => { };
-let callbackIds : string[] = [];
+
export function onCallbackChange(fn : (eventLog : string) => void) {
callback = fn
}
-export function registerCallbacks() {
-
- let reg1 = UTSAndroid.registerActivityCallback(new UTSAcvitiyLifeCycleCallback())
- let reg2 = UTSAndroid.registerActivityCallback(new UTSActivityWindowCallback())
- let reg3 = UTSAndroid.registerActivityCallback(new UTSAcvitiyKeyEventCallback())
- let reg4 = UTSAndroid.registerActivityCallback(new UTSActivityCallback())
- let reg5 = UTSAndroid.registerActivityCallback(new UTSActivityComponentCallback())
- callbackIds.push(reg1)
- callbackIds.push(reg2)
- callbackIds.push(reg3)
- callbackIds.push(reg4)
- callbackIds.push(reg5)
-
-}
-
-export function unRegisterCallbacks() {
- callbackIds.forEach((value) => {
- console.log(value)
- UTSAndroid.unRegisterActivityCallback(value)
- })
-}
-
export class UTSAcvitiyLifeCycleCallback extends UniActivityLifeCycleCallback {
constructor() {