Hi,
I want to enforce enterprise security by restricting the use of some
applications like youtube or gtalk.
My service runs in the background and it should show the home screen
on launch of any of the blacklisted applications.
However, there is no intent for Activity/application launch.
Please let me know how to do this.
I have tried this :
ActivityManager activityManager = (ActivityManager)
this.getSystemService(ACTIVITY_SERVICE);
List<RunningTaskInfo> tasks = activityManager.getRunningTasks(3);
ComponentName componentInfo = tasks.get(0).topActivity;
String pkgName = componentInfo.getPackageName();
if (pkgName.contains("com.google.android.youtube")){
activityManager.killBackgroundProcesses(pkgName);
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
homeIntent.addCategory(Intent.CATEGORY_HOME);
homeIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(homeIntent);
}
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en