提交 9cedb423 编写于 作者: 打打卡夫卡's avatar 打打卡夫卡

读取meta 结点的示例兼容自定义基座

上级 1cfb37fd
...@@ -152,7 +152,7 @@ ...@@ -152,7 +152,7 @@
icon:"none", icon:"none",
title: '读取成功,注意查看控制台输出' title: '读取成功,注意查看控制台输出'
}); });
console.log("meta节点['DCLOUD_READ_PHONE_STATE'] 配置的值为:" + ret); console.log(ret);
}, },
testLifecyle: function() { testLifecyle: function() {
uni.navigateTo({ uni.navigateTo({
......
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools"
package="io.dcloud.uni_modules.uts_advance"
>
<!--permissions-->
<application><meta-data android:name="UTS_CUSTOM_LAUNCHER_META" android:value="HelloUTS" /></application>
</manifest>
...@@ -21,7 +21,7 @@ import Toast from 'android.widget.Toast'; ...@@ -21,7 +21,7 @@ import Toast from 'android.widget.Toast';
import AlertDialog from 'android.app.AlertDialog'; import AlertDialog from 'android.app.AlertDialog';
import DialogInterface from 'android.content.DialogInterface'; import DialogInterface from 'android.content.DialogInterface';
import EditText from 'android.widget.EditText'; import EditText from 'android.widget.EditText';
import R from 'io.dcloud.uni_modules.uts_advance.R';
import { import {
onAppActivityDestroy, onAppActivityDestroy,
...@@ -228,9 +228,15 @@ export function getMetaConfig(): string { ...@@ -228,9 +228,15 @@ export function getMetaConfig(): string {
} }
let adId = metaData.getString("DCLOUD_READ_PHONE_STATE") let adId = metaData.getString("DCLOUD_READ_PHONE_STATE")
if (adId == null) { if (adId == null) {
return ""; // 没有数据,说明是自定义基座,则读取自定义基座的配置
let customMetaId = metaData.getString("UTS_CUSTOM_LAUNCHER_META")
if(customMetaId == null){
return ""
}
return "自定义基座[UTS_CUSTOM_LAUNCHER_META]:" + customMetaId;
} }
return adId; // 标准基座
return "标准基座[DCLOUD_READ_PHONE_STATE]:" + adId;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册