0

このコードを使用して、ホーム画面へのショートカットを追加しました。正常に動作しますが、アプリをアンインストールすると、追加されたショートカットが自動的に削除されません。

    Intent shortcutIntent = new Intent(Intent.ACTION_VIEW);
    Uri uri = Uri.parse("https://some.url/path"); 
    shortcutIntent.setData(uri);

    Intent addIntent = new Intent();
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_INTENT, shortcutIntent);
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_NAME, "name");
    addIntent.putExtra(Intent.EXTRA_SHORTCUT_ICON_RESOURCE, 
                      Intent.ShortcutIconResource.fromContext(context, 
                                          R.mipmap.ic_launcher));
    addIntent.putExtra("duplicate", false); 
    addIntent.setAction(ACTION_INSTALL_SHORTCUT);
    context.sendBroadcast(addIntent);

明らかな何かが欠けていますか?
どんな助けでも大歓迎です。

4

0 に答える 0