提交 1de30723 编写于 作者: 杜庆泉's avatar 杜庆泉

截屏插件 code字段修改

上级 4edbeb73
......@@ -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:'截屏监听已开启'
......
......@@ -40,6 +40,7 @@
<uni-list-item @tap="testLifecyle" title="activity生命周期监听" :clickable="true" link />
<uni-list-item @tap="gotoDecorView" title="操作DecorView" :clickable="true" link />
<uni-list-item @tap="testAssetLoad" title="播放asset音频(需自定义基座)" :clickable="true" />
<uni-list-item @tap="testMetaRead" title="读取meta配置(需自定义基座)" :clickable="true" />
</uni-list>
......@@ -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'
......
......@@ -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() {
}
/**
* 初始化应用生命周期监听
*
......
......@@ -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({});
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册