0

8 android 以降、アプリケーション アイコンがショートカットに表示されます。

ここに画像の説明を入力

これは、どのアプリがショートカットを作成したかをユーザーに通知するために特別に追加されたことを知っています。

アイコンを作成するために現在使用されているコードは次のとおりです。

   ShortcutManager shortcutManager = (ShortcutManager) context.getSystemService(Context.SHORTCUT_SERVICE);
    BitmapDrawable bd = (BitmapDrawable) ic;
    if (shortcutManager.isRequestPinShortcutSupported()) {
        Intent shortcutInfoIntent = new Intent(context, MainActivity.class);
        shortcutInfoIntent.setAction(Intent.ACTION_VIEW);
        shortcutInfoIntent.putExtra("pckg", pck);

        ShortcutInfo info = new ShortcutInfo.Builder(context, "iconId")
                .setIcon(Icon.createWithBitmap(bd.getBitmap()))
                .setShortLabel(label)
                .setIntent(shortcutInfoIntent)
                .build();

        PendingIntent shortcutCallbackIntent = PendingIntent.getBroadcast(context, 0, new Intent(context, MyReceiver.class), PendingIntent.FLAG_UPDATE_CURRENT);

        shortcutManager.requestPinShortcut(info, shortcutCallbackIntent.getIntentSender());
    }

これがかなり一般的な問題であることは知っていますが、誰も正常な解決策を提供していません。でもどうにか持ち去らないといけない

これらのバッジなしでアイコンが作成されるx icon changerに実装されているため、これが可能であると確信しています。

それを修正する方法をすべてあなたのアイデアを書いてください

4

2 に答える 2