马上注册,解锁更多高级玩法
您需要 登录 才可以下载或查看,没有账号?立即注册
×
[JavaScript] 纯文本查看 复制代码 app.intent = function (i) {
var intent = new android.content.Intent();
if (i.className && i.packageName) {
intent.setClassName(i.packageName, i.className);
}
if (i.extras) {
for (var key in i.extras) {
intent.putExtra(key, i.extras[key]);
}
}
if (i.category) {
if (i.category instanceof Array) {
for (var j = 0; i < i.category.length; j++) {
intent.addCategory(i.category[j]);
}
} else {
intent.addCategory(i.category);
}
}
if (i.action) {
if (i.action.indexOf(".") == -1) {
i.action = "android.intent.action." + i.action;
}
intent.setAction(i.action);
}
if (i.flags) {
let flags = 0;
if (Array.isArray(i.flags)) {
for (let j = 0; j < i.flags.length; j++) {
flags |= parseIntentFlag(i.flags[j]);
}
} else {
flags = parseIntentFlag(i.flags);
}
intent.setFlags(flags);
}
if (i.type) {
if (i.data) {
intent.setDataAndType(app.parseUri(i.data), i.type);
} else {
intent.setType(i.type);
}
} else if (i.data) {
intent.setData(android.net.Uri.parse(i.data));
}
return intent;
}
//用法. 跳转到抖音用户视频页
var i = app.intent({
data:"snssdk1128://aweme/detail/7264853865835531574?browser_name=safari&did=MS4wLjABAAAALOcz-_R2cdwAmx2BzOYcXUSfRF5jtoQvi6wpPFTbuSxy4A1GDK9TPG8H2GAKJYlx&from=web_code_link&from_ssr=1&gd_label=click_schema_lhft_41030704a&group_id=7264853865835531574&host=www.iesdouyin.com&iid=MS4wLjABAAAANwkJuWIRFOzg5uCpDRpMj4OX-QryoDgn-yYlXQnRwQQ&launch_method=click_wap_rf_video_top_banner&mid=7264853928205110076&needlaunchlog=1&refer=web&referrer_host=www.iesdouyin.com®ion=CN&scene_from=share_reflow&share_sign=CKf0abjGw27J3Cyxoqn9xK.XAbc.1dr4t1VKV68mEII-&share_version=170400&titleType=title&ts=1697875728&u_code=0&web_id=7270420314449217039&with_sec_did=1&zlink=https%3A%2F%2Fz.douyin.com%2FtA4V&zlink_click_time=1697875760&__reporte_stage=launch"
});
getCon().startActivity(i)
|