跳转
### 重启后台
```
packageToEarliest('com.tencent.mobileqq');
function packageToEarliest(packageName) {//重启应用后台
intent = context.getPackageManager().getLaunchIntentForPackage(packageName);
intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK); app.startActivity(intent);
}
```
### qq空间加好友
```
// qq空间加好友("1794558373")
function qq空间加好友(qq号) {//qq空间跳转
app.startActivity({
action: "android.intent.action.VIEW",
data: "mqqapi://forward/url?url_prefix=" + $base64.encode("https://mp.qzone.qq.com/u/?uin=" + qq号) + "&version=1&src_type=internal",
packageName: "com.tencent.mobileqq",
});
}
```
### 小世界加好友
```
// app.startActivity({
// data: "mqqapi://qcircle/openmainpage?uin=" + "582358270" + "&issinglefeed=1&from=6&sharecategory=2&shareentrance=1",
// packageName: "com.tencent.mobileqq", //包名
// });
```
### 拼多多指定商品
```
function 拼多多指定商品跳转(PddUrl) {
for (let i = 0; i < 3; i++) {
try {
app.startActivity({
data: "pinduoduo://com.xunmeng.pinduoduo/goods.html?goods_id=" + PddUrl
});
sleep(2000)
return true
} catch (e) {
log(i + "解析跳转出错,5s后重试:", e.message)
}
sleep(5000)
}
}
//首页 data: "pinduoduo://open.homepage"
```