牙叔教程 简单易懂
"ui"; ui.layout( <vertical> <button>牙叔教程</button> </vertical> ); setTimeout(function () { activity.moveTaskToBack(true); }, 2000); setTimeout(function () { let manager = context.getSystemService(context.ACTIVITY_SERVICE); let recentTasks = manager.getRunningTasks(java.lang.Integer.MAX_VALUE); for (let i = 0; i < recentTasks.size(); i++) { log("xk", " " + recentTasks.get(i).baseActivity.toShortString() + " ID: " + recentTasks.get(i).id + ""); log("xk", "@@@@ " + recentTasks.get(i).baseActivity.toShortString()); // bring to front if ( recentTasks .get(i) .baseActivity.toShortString() .indexOf("org.autojs.autojspro/org.autojs.autojs.ui.main.MainActivity") > -1 ) { manager.moveTaskToFront(recentTasks.get(i).id, android.app.ActivityManager.MOVE_TASK_WITH_HOME); } } }, 4000);
// 点击返回回到桌面,不退出程序 ui.emitter.on("back_pressed", function (e) { e.consumed = true; var i = app.intent({ action: Intent.ACTION_MAIN, category: Intent.CATEGORY_HOME, flags: ['ACTIVITY_NEW_TASK'] }); context.startActivity(i); });
参考
名人名言
思路是最重要的, 其他的百度, bing, stackoverflow, 安卓文档, autojs文档, 最后才是群里问问
--- 牙叔教程
声明
部分内容来自网络
本教程仅用于学习, 禁止用于其他用途