I was trying to create a process killing extension So whole code is here
import android.app.Activity;
import android.app.ActivityManager;
import com.google.appinventor.components.annotations.SimpleFunction;
import com.google.appinventor.components.runtime.AndroidNonvisibleComponent;
import com.google.appinventor.components.runtime.ComponentContainer;
import com.google.appinventor.components.runtime.util.YailList;
import java.util.ArrayList;
import java.util.List;
public class KillTask extends AndroidNonvisibleComponent {
private Activity activity;
public KillTask(ComponentContainer componentContainer) {
super(componentContainer.$form());
this.activity = componentContainer.$context();
}
@SimpleFunction
public YailList KillTask() {
ActivityManager activityManager = (ActivityManager) getActivity().getSystemService(Context.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> runAppList = activityManager.getRunningAppProcesses();
int listsize = runAppList.size();
if (runAppList != null) {
for (int i = 0; i < listsize; ++i) {
if (runAppList.get(i).pid != android.os.Process.myPid()) {
android.os.Process.killProcess(runAppList.get(i).pid);
activityManager.killBackgroundProcesses(runAppList.get(i).processName);
}
}
} }
Note : this java code is written by my senior java teacher for killing process but sir told me he also don't know about making extension for MIT app inventor and he said "ask someone to adjust code the for extension " and i am having one AndroidRuntime jar file for this
I am also from different country and my english is not prefect.
so anyone can adjust the code and make an aix file ?
edit: Updated code by my sir
any help