开发者

Is there any way to kill application with known package name?

开发者 https://www.devze.com 2023-03-18 15:07 出处:网络
I am using following code: for(int i = 0; i < numOfTasks; i++) ActivityManager.RunningAppProcessInfo task = tasksP.get(i);

I am using following code:

for(int i = 0; i < numOfTasks; i++)
ActivityManager.RunningAppProcessInfo task = tasksP.get(i);

from task.processName I am getting process package nam开发者_如何学Goe e.g com.android.alarmclock (running app)

I want to kill this application, is there anyway to do that ??


There is two way of killing an application

/* Way one */
android.os.Process.killProcess(android.os.Process.myPid())

/* Way Two */
System.exit(0);
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号