title: Trying to UNINSTALL_SHORTCUT but shortcut won't go away
body: <p>I created a test Activity that installs a shortcut of itself on the Android Home screen.  When you click a button, the Activity is supposed to remove the same shortcut it just created.  However, nothing I do seems to delete the shortcut.</p>
  
  <p>Here is the Java code (ShortcutTest.java):</p>
  
  <pre><code>import java.net.URISyntaxException;
  import android.app.Activity;
  import android.content.Context;
  import android.content.Intent;
  import android.os.Bundle;
  import android.util.Log;
  import android.view.View;
  import android.view.View.OnClickListener;
  import android.widget.Button;
  
  public class ShortcutTest extends Activity {
      String shortcutUri;
  
      @Override
      public void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.main);
  
          addShortcut(getBaseContext());
  
          Button button = (Button)findViewById(R.id.Button01);
          button.setOnClickListener(new OnClickListener() {
              @Override
              public void onClick(View v) {
                  removeShortcut(getBaseContext());
                  finish();
              }
          });
      }
  
      public void addShortcut(Context context) {
          Intent shortcutIntent = new Intent();
          shortcutIntent.setClassName("com.telespree.android.client", "com.telespree.android.client.ShortcutTest");
          shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
          shortcutIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
  
          Intent intent = new Intent();
          intent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
          intent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "ShortcutTest");
          intent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, Intent.ShortcutIconResource.fromContext(context, R.drawable.icon));
          intent.setAction("com.android.launcher.action.INSTALL_SHORTCUT");
          shortcutUri = intent.toUri(MODE_WORLD_WRITEABLE);
          context.sendBroadcast(intent);
      }
  
      public void removeShortcut(Context context) {
          Intent intent = null;
          try {
              intent = Intent.parseUri(shortcutUri, 0);
          } catch (URISyntaxException e) {
          }
          intent.setAction("com.android.launcher.permission.UNINSTALL_SHORTCUT");
          context.sendBroadcast(intent);
      }
  }
  </code></pre>
  
  <p>Here is the Manifest:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;manifest xmlns:android="http://schemas.android.com/apk/res/android"
        package="com.telespree.android.client"
        android:versionCode="1"
        android:versionName="1.0"&gt;
  
        &lt;permission
          android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"
          android:permissionGroup="android.permission-group.SYSTEM_TOOLS"
          android:protectionLevel="normal"
          /&gt;
  
      &lt;application android:icon="@drawable/icon" android:label="@string/app_name"&gt;
          &lt;activity android:name=".ShortcutTest"
                    android:label="@string/app_name" android:theme="@android:style/Theme.Translucent"&gt;
              &lt;intent-filter&gt;
                  &lt;action android:name="android.intent.action.MAIN" /&gt;
                  &lt;category android:name="android.intent.category.LAUNCHER" /&gt;
              &lt;/intent-filter&gt;
          &lt;/activity&gt;
  
      &lt;/application&gt;
  
      &lt;uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT"/&gt;
      &lt;!-- 
      &lt;uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT"/&gt;
       --&gt;
  
      &lt;uses-sdk android:minSdkVersion="7" /&gt;
  
  &lt;/manifest&gt; 
  </code></pre>
  
  <p>I'm almost positive there is some kind of permissions problem, though I've seen other posts on the Internet that indicates this should be possible.  </p>
  
  <p>Any advice is greatly appreciated.</p>
  
  <p>Thanks.</p>