android6.0以后怎么删除快捷方式?

private void createShortCut() {
    Log.i("TAG", "创建快捷方式");
    Intent shortcutintent = new Intent("com.android.launcher.action.INSTALL_SHORTCUT");
    shortcutintent.putExtra("duplicate", false);
    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));
    Intent.ShortcutIconResource icon = Intent.ShortcutIconResource.fromContext(this, R.drawable.ic_launcher);
    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, icon);
    shortcutintent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, getShortCutIntent());
    sendBroadcast(shortcutintent);
}

private void delectShortCut() {
    Log.i("TAG", "删除快捷方式");
    Intent shortcut = new Intent("com.android.launcher.action.UNINSTALL_SHORTCUT");
    shortcut.putExtra(Intent.EXTRA_SHORTCUT_NAME, getString(R.string.app_name));

    shortcut.putExtra(Intent.EXTRA_SHORTCUT_INTENT, getShortCutIntent());
    sendBroadcast(shortcut);

}

private Intent getShortCutIntent() {
    Intent intent = new Intent();
    intent.setClass(this, this.getClass());
    /*以下两句是为了在卸载应用的时候同时删除桌面快捷方式*/
    intent.setAction("android.intent.action.MAIN");
    intent.addCategory("android.intent.category.LAUNCHER");
    return intent;
}

权限:

    <uses-permission android:name="com.android.launcher.permission.INSTALL_SHORTCUT" />
    <uses-permission android:name="com.android.launcher.permission.UNINSTALL_SHORTCUT" />

模拟器测试5.0 可以正常创建和删除快捷方式;6.0以后可以创建,但是调用delectShortCut(),却删除不了快捷方式。求解

https://blog.csdn.net/dreamkid0924/article/details/53284880

https://blog.csdn.net/lanfei1027/article/details/48297409
看下这个 应该可以解决

还有的是有的手机本身就没有了快捷方式,也就不存在删除了