Android-Close Other Apps
Posted
by
Luke
on Stack Overflow
See other posts from Stack Overflow
or by Luke
Published on 2010-12-21T19:47:49Z
Indexed on
2010/12/21
19:54 UTC
Read the original article
Hit count: 244
I have some code that will launch a different application using intents but what can I do to close or kill the other app?
Here is the launch code (works great): 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 the background processes but no luck: ActivityManager activityManager = (ActivityManager) context.getSystemService(context.ACTIVITY_SERVICE); activityManager.killBackgroundProcesses("com.pandora.android"); I also tried this to kill it: context.stopService(new Intent(context, Class.forName("com.bla.bla")));
© Stack Overflow or respective owner