Dynamic Launcher Shortcuts
suggest changeShortcutManager was added in API 25.
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
ShortcutInfo shortcut = new ShortcutInfo.Builder(this, "id1")
.setShortLabel("Web site") // Shortcut Icon tab
.setLongLabel("Open the web site") // Displayed When Long Pressing On App Icon
.setIcon(Icon.createWithResource(this, R.drawable.icon_website))
.setIntent(new Intent(Intent.ACTION_VIEW,
Uri.parse("https://www.mysite.example.com/")))
.build();
shortcutManager.setDynamicShortcuts(Arrays.asList(shortcut));
Remove every dynamic shortcut with:
shortcutManager.removeAllDynamicShortcuts();
Update shortcuts that already exist with:
shortcutManager.updateShortcuts(Arrays.asList(shortcut));
setDynamicShortcuts(List) replaces the whole list of dynamic shortcuts. addDynamicShortcuts(List) adds shortcuts to the list already published.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents