How to remove shortcuts in the home screen(programatically). I can remove the shortcuts created by me using intent but not other existing ones..
Bitmap theBitmap = ((BitmapDrawable)icon).getBitmap();
Intent shortcutIntent = new Intent();
shortcutIntent.setAction(Intent.ACTION_VIEW);
shortcutIntent.setClassName(url, group);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
Intent removeIntent = new Intent();
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, name);
removeIntent.putExtra("duplicate", false);
removeIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON, theBitmap);
removeIntent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
sendBroadcast(removeIntent);
when deleting using intent as above, it is possible to delete shortcut when knowing the icon packagename + app class name. we can get icon package name of all application using PackageInfo as follows but not the launch class name
ArrayList<PInfo> res = new ArrayList<PInfo>();
List<PackageInfo> packs = getPackageManager().getInstalledPackages(0);
for(int i=0;i<packs.size();i++) {
PackageInfo p = packs.get(i);
if ((!getSysPackages) && (p.versionName == null)) {
continue ;
}
PInfo newInfo = new PInfo();
newInfo.appname = p.applicationInfo.loadLabel(getPackageManager()).toString();
newInfo.pname = p.packageName;
newInfo.classname = p.applicationInfo.className;
newInfo.versionCode = p.versionCode;
newInfo.icon = p.applicationInfo.loadIcon(getPackageManager());
Now problem is, Is there any method to get class name of a application, then we can delete the shortcut created by this application in the home Screen.. any help??
you cannot remove programatically other shortcuts from homescreen