ShortcutManagerCompat

public class ShortcutManagerCompat
extends Object

java.lang.Object
   ↳ androidx.core.content.pm.ShortcutManagerCompat


Helper for accessing features in ShortcutManager.

Summary

Constants

String EXTRA_SHORTCUT_ID

Key to get the shortcut ID from extras of a share intent.

int FLAG_MATCH_CACHED

Include cached shortcuts in the result.

int FLAG_MATCH_DYNAMIC

Include dynamic shortcuts in the result.

int FLAG_MATCH_MANIFEST

Include manifest shortcuts in the result.

int FLAG_MATCH_PINNED

Include pinned shortcuts in the result.

Public methods

static boolean addDynamicShortcuts(Context context, List<ShortcutInfoCompat> shortcutInfoList)

Publish the list of dynamic shortcuts.

static Intent createShortcutResultIntent(Context context, ShortcutInfoCompat shortcut)

Returns an Intent which can be used by the launcher to pin shortcut.

static void disableShortcuts(Context context, List<String> shortcutIds, CharSequence disabledMessage)

Disable pinned shortcuts, showing the user a custom error message when they try to select the disabled shortcuts.

static void enableShortcuts(Context context, List<ShortcutInfoCompat> shortcutInfoList)

Re-enable pinned shortcuts that were previously disabled.

static List<ShortcutInfoCompat> getDynamicShortcuts(Context context)

Return all dynamic shortcuts from the caller app.

static int getIconMaxHeight(Context context)

Return the max height for icons, in pixels.

static int getIconMaxWidth(Context context)

Return the max width for icons, in pixels.

static int getMaxShortcutCountPerActivity(Context context)
static List<ShortcutInfoCompat> getShortcuts(Context context, int matchFlags)

Returns ShortcutInfoCompats that match matchFlags.

static boolean isRateLimitingActive(Context context)

Return true when rate-limiting is active for the caller app.

static boolean isRequestPinShortcutSupported(Context context)
static boolean pushDynamicShortcut(Context context, ShortcutInfoCompat shortcut)

Publish a single dynamic shortcut.

static void removeAllDynamicShortcuts(Context context)

Delete all dynamic shortcuts from the caller app.

static void removeDynamicShortcuts(Context context, List<String> shortcutIds)

Delete dynamic shortcuts by ID.

static void removeLongLivedShortcuts(Context context, List<String> shortcutIds)

Delete long lived shortcuts by ID.

static void reportShortcutUsed(Context context, String shortcutId)

Apps that publish shortcuts should call this method whenever the user selects the shortcut containing the given ID or when the user completes an action in the app that is equivalent to selecting the shortcut.

static boolean requestPinShortcut(Context context, ShortcutInfoCompat shortcut, IntentSender callback)

Request to create a pinned shortcut.

static boolean setDynamicShortcuts(Context context, List<ShortcutInfoCompat> shortcutInfoList)

Publish the list of shortcuts.

static boolean updateShortcuts(Context context, List<ShortcutInfoCompat> shortcutInfoList)

Update all existing shortcuts with the same IDs.

Inherited methods