command 'autojspro.listAll' not found
// This code is provided by Feiyun script circle www.feiyunjs.com
var window = floaty.window(
<frame gravity="center">
<text id="text" textSize="12sp" textColor="#FFFF00FF"/>
</frame>
);
window.exitOnClose();
var i = 0;
setInterval(function(){
//File path
var path = "/sdcard/1.txt";
//File contents to write
//Open file in write mode
var file = open(path, "a");
//file:week(set)
//write file
file.writeline(["\n\n Current package name: " + currentPackage() + "\n",
"Current app name: " + app.getAppName(currentPackage())+ "\n",
"current activity: " + currentActivity()]);
//Close file
//Add a line "cheerleading"
file.writeline("");
//Add a line "hahahaha"
//file.writeline("hahahaha");
//Add two lines of ccc, ddd
//file.writelines(["ccc", "ddd"]);
//Output buffer
file.flush();
//Close file
file.close();
if(i == 5){
exit()
}
}, 4000);
window.text.click(()=>{
window.setAdjustEnabled(!window.isAdjustEnabled());
setClip(currentActivity());
toast(" Already copied\n current activity:\n " + currentActivity())
});
setInterval(()=>{
//Operations on the control need to be performed in the UI thread
ui.run(function(){
window.text.setText(dynamicText());
});
}, 1000);
function dynamicText(){
var date = new Date();
var str = util.format("time: %d:%d:%d\n\n", date.getHours(), date.getMinutes(), date.getSeconds());
str += util.format("Memory usage: %d%%\n\n", getMemoryUsage());
str += "Current package name: \n" + currentPackage() + "\n\n";
str += "Current app name: \n" + app.getAppName(currentPackage())+ "\n\n";
str += "current activity: \n" + currentActivity();
return str;
}
//Get memory usage
function getMemoryUsage(){
var usage = (100 * device.getAvailMem() / device.getTotalMem());
//Keep one decimal place
return Math.round(usage * 100) / 100;
}