Trying to UNINSTALL_SHORTCUT but shortcut won't go away

后端 未结 5 786
小蘑菇
小蘑菇 2020-11-28 10:18

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 ju

5条回答
  •  北海茫月
    2020-11-28 10:40

    It took me about an hour of debugging and trying out every example on stackoverflow, but the solution was very easy. There's a typo in your code: You need to use com.android.launcher.action.UNINSTALL_SHORTCUT (as opposed to permission, as it is in the Manifest)

    intent.setAction("com.android.launcher.action.UNINSTALL_SHORTCUT");
    

    Edit: answer amended

提交回复
热议问题