diff --git a/pages/SystemAPI/ScreenListen/screenlisten.vue b/pages/SystemAPI/ScreenListen/screenlisten.vue index a5379a2144bb44e2ea4760e2169887776eb1034d..0a734529c7bf4b8956dddf79b7394aad10be2808 100644 --- a/pages/SystemAPI/ScreenListen/screenlisten.vue +++ b/pages/SystemAPI/ScreenListen/screenlisten.vue @@ -34,10 +34,10 @@ if (uni.getSystemInfoSync().platform == "android") { // 除android 之外的平台,不需要判断返回状态码 - if(res.code == -1){ + if(res.errCode == -1){ // 启动失败 return ; - }else if(res.code == 0){ + }else if(res.errCode == 0){ uni.showToast({ icon:"none", title:'截屏监听已开启' diff --git a/pages/advance/advance.vue b/pages/advance/advance.vue index 6c23c241783e33a4c2b31bdd0587143df5dea2f4..f50785c84a3cbd3cc303b54a3ce953ece987fb30 100644 --- a/pages/advance/advance.vue +++ b/pages/advance/advance.vue @@ -40,6 +40,7 @@ + @@ -54,7 +55,8 @@ doTimerTask, doIntervalTask, clearIntervalTask, - playAssetAudio + playAssetAudio, + getMetaConfig } from "../../uni_modules/uts-advance"; @@ -133,6 +135,14 @@ playAssetAudio(); }, + testMetaRead() { + let ret = getMetaConfig(); + uni.showToast({ + icon:"none", + title: '读取成功,注意查看控制台输出' + }); + console.log("meta节点['DCLOUD_READ_PHONE_STATE'] 配置的值为:" + ret); + }, testLifecyle: function() { uni.navigateTo({ url: '/pages/lifecycle/lifecycle' diff --git a/uni_modules/uts-advance/utssdk/app-android/index.uts b/uni_modules/uts-advance/utssdk/app-android/index.uts index 2d82bc1c0b564d60731ef6acc53d0735685ab656..38cad64093376ad7fec88086adcf18a41943bb26 100644 --- a/uni_modules/uts-advance/utssdk/app-android/index.uts +++ b/uni_modules/uts-advance/utssdk/app-android/index.uts @@ -7,6 +7,7 @@ import Runnable from 'java.lang.Runnable'; import MediaPlayer from 'android.media.MediaPlayer'; import logo from "../../static/logo.png"; +import PackageManager from "android.content.pm.PackageManager"; import { onAppActivityDestroy, @@ -132,6 +133,30 @@ export function removeViewToDecorView() { } + + + +/** + * 引用资源路径 + */ +export function getMetaConfig(): string { + // + let packageName = getAppContext()!.getPackageName(); + let appInfo = getAppContext()!.getPackageManager()!.getApplicationInfo(packageName,PackageManager.GET_META_DATA) + + let metaData = appInfo.metaData + if (metaData == null) { + return ""; + } + let adId = metaData.getString("DCLOUD_READ_PHONE_STATE") + if (adId == null) { + return ""; + } + return adId; +} + + + /** * 引用资源路径 */ @@ -154,6 +179,9 @@ export function playAssetAudio() { } + + + /** * 初始化应用生命周期监听 * diff --git a/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.jpg b/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.jpg new file mode 100644 index 0000000000000000000000000000000000000000..da71a5b5d407a4927c94beaf585e4919ec7b3ced Binary files /dev/null and b/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.jpg differ diff --git a/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.png b/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.png new file mode 100644 index 0000000000000000000000000000000000000000..da71a5b5d407a4927c94beaf585e4919ec7b3ced Binary files /dev/null and b/uni_modules/uts-advance/utssdk/app-android/res/drawable/android_res_drawable.png differ diff --git a/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts b/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts index a6d42d3fab66afe6762c30d2fc67263b9855376e..4855c48aa409d7578e4cb02021c202e1ae02b8da 100644 --- a/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts +++ b/uni_modules/uts-screenshot-listener/utssdk/app-android/index.uts @@ -65,7 +65,7 @@ class ScreenFileObserver extends FileObserver { lastFileObserverTime = System.currentTimeMillis() let ret = { - code:1, + errCode:1, image:newPath } @@ -93,7 +93,7 @@ export function onUserCaptureScreen(callback: (res:UTSJSONObject) => void) { // 因权限缺失导致监听失败 let ret = { - code:-1 + errCode:-1 } callback(ret); return ; @@ -121,7 +121,7 @@ export function onUserCaptureScreen(callback: (res:UTSJSONObject) => void) { // 监听成功 let ret = { - code:0 + errCode:0 } callback(ret); @@ -140,10 +140,7 @@ export function offUserCaptureScreen(success: (res: any) => void) { } lastFileObserverTime = 0; - let ret = { - - } - success(ret); + success({}); }