Android: How to Remove/Uninstall application shortcuts from Home Screen?
<p>I have been trying to (ADD and then) REMOVE my APP's shortcut from HOME-SCREEN.
ADDING a shortcut works perfectly however I'm not able to remove the shortcut I've created using below code.</p>

<pre><code>public void setupShortCut(boolean create) {
        shortcutIntent = new Intent();
        shortcutIntent.setClassName("com.abc.xyz", "XYZActivity");
        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
        shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);

        icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.icon);

        Intent intentShortcut = new Intent();
        intentShortcut.putExtra("android.intent.extra.shortcut.INTENT", shortcutIntent);
        intentShortcut.putExtra("android.intent.extra.shortcut.NAME", getResources().getString(R.string.app_name));
        intentShortcut.putExtra("android.intent.extra.shortcut.ICON_RESOURCE", icon);
        if(create) {
          intentShortcut.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
        } else {
        intentShortcut.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
        }
        sendBroadcast(intentShortcut);
    }
</code></pre>

<p>Please suggest where am I going wrong?</p>

<p><strong>EDIT 1:</strong></p>

<p>I have required permission in my Manifest file:</p>

<pre><code>&lt;uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" /
</code></pre>

<p><strong>EDIT 2: FIGURED OUT THE ROOT CAUSE :-)</strong></p>

<p>I figured out the reason why it wasn't working for me.
I am using a different 3rd party launcher (other than Stock android launcher) on my phone.
CREATING and REMOVING an <code>App-Shortcut</code> works as long as the launcher you are using supports that operation.
I ran the above code on default launcher and it works like a charm :)</p>

<p>Anyway, thank you everyone for your replies!</p>
