I am creating an application for creating icons, like Ume Icon Changer and now I am using this code to create an icon
public static void createShortCut3(Context context, Drawable drawable, String shortcutname, String packagename){
Intent intent = context.getPackageManager().getLaunchIntentForPackage(packagename);
BitmapDrawable bd = (BitmapDrawable) drawable;
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
ShortcutManager shortcutManager =
context.getSystemService(ShortcutManager.class);
if (shortcutManager.isRequestPinShortcutSupported()) {
ShortcutInfo pinShortcutInfo =
new ShortcutInfo.Builder(context, "app-shortcut")
.setIntent(intent)
.setShortLabel(shortcutname)
.setIcon(Icon.createWithAdaptiveBitmap(bd.getBitmap()))
.build();
Intent pinnedShortcutCallbackIntent =
null;
pinnedShortcutCallbackIntent = shortcutManager.createShortcutResultIntent(pinShortcutInfo);
PendingIntent successCallback = PendingIntent.getBroadcast(context, 0,
pinnedShortcutCallbackIntent, PendingIntent.FLAG_UPDATE_CURRENT);
shortcutManager.requestPinShortcut(pinShortcutInfo,
successCallback.getIntentSender());
}
}
}
But all my icons are created with this badge.
As I understand it, you can't just remove it. But in ume icon changer and in other applications this is done somehow through the widget.
How can I implement a similar function?