I have code that will launch another application using intentions, but what can I do to shut down or kill another application?
Here is the startup code (works fine):
Intent i = new Intent(); i.setAction(Intent.ACTION_MAIN); i.addCategory(Intent.CATEGORY_LAUNCHER); i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); i.setComponent( new ComponentName(resolveInfo.activityInfo.applicationInfo.packageName, resolveInfo.activityInfo.name));
I tried to kill background processes, but no luck:
ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); activityManager.killBackgroundProcesses("com.pandora.android");
I also tried this to kill him:
context.stopService(new Intent(context, Class.forName("com.bla.bla")));
Update:
I want to kill other applications, because I launch other applications, and users requested this additional function (automatic killing is a natural continuation of automatic launch). Answer the question of how to do this in code. I know about Advanced Task Mgr, so it's possible, but how?
source share