Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels) Summary: [Constants](https://developer.android.com/reference/android/content/pm/ShortcutManager#constants) \| [Methods](https://developer.android.com/reference/android/content/pm/ShortcutManager#pubmethods) \| [Inherited Methods](https://developer.android.com/reference/android/content/pm/ShortcutManager#inhmethods)

# ShortcutManager

*** ** * ** ***


`
public


class
ShortcutManager
`


`

extends https://developer.android.com/reference/java/lang/Object


`

`


`

|---|---|
| [java.lang.Object](https://developer.android.com/reference/java/lang/Object) ||
| ↳ | android.content.pm.ShortcutManager |

<br />

*** ** * ** ***

<br />

`ShortcutManager` executes operations on an app's set of *shortcuts*, which
represent specific tasks and actions that users can perform within your app. This page lists
components of the `ShortcutManager` class that you can use to create and manage
sets of shortcuts.

To learn about methods that retrieve information about a single shortcut---including
identifiers, type, and status---read the `
https://developer.android.com/reference/android/content/pm/ShortcutInfo` reference.

For guidance about using shortcuts, see
[App shortcuts](https://developer.android.com/guide/topics/ui/shortcuts).

### Retrieving class instances

.   
Restricted for SDK Runtime environment in API level 34.

<br />

## Summary

| ### Constants ||
|---|---|
| `int` | `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_CACHED` Include cached shortcuts in the result. |
| `int` | `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_DYNAMIC` Include dynamic shortcuts in the result. |
| `int` | `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_MANIFEST` Include manifest shortcuts in the result. |
| `int` | `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_PINNED` Include pinned shortcuts in the result. |

| ### Public methods ||
|---|---|
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#addDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo> shortcutInfoList) ` Publish the list of dynamic shortcuts. |
| ` https://developer.android.com/reference/android/content/Intent` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#createShortcutResultIntent(android.content.pm.ShortcutInfo)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut) ` Returns an Intent which can be used by the default launcher to pin a shortcut containing the given `https://developer.android.com/reference/android/content/pm/ShortcutInfo`. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#disableShortcuts(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds) ` Disable pinned shortcuts. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#disableShortcuts(java.util.List<java.lang.String>,%20java.lang.CharSequence)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds, https://developer.android.com/reference/java/lang/CharSequence disabledMessage) ` Disable pinned shortcuts, showing the user a custom error message when they try to select the disabled shortcuts. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#enableShortcuts(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds) ` Re-enable pinned shortcuts that were previously disabled. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getDynamicShortcuts()() ` Return all dynamic shortcuts from the caller app. |
| ` int` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getIconMaxHeight()() ` Return the max height for icons, in pixels. |
| ` int` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getIconMaxWidth()() ` Return the max width for icons, in pixels. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getManifestShortcuts()() ` Return all static (manifest) shortcuts from the caller app. |
| ` int` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getMaxShortcutCountPerActivity()() ` Return the maximum number of static and dynamic shortcuts that each launcher icon can have at a time. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getPinnedShortcuts()() ` Return all pinned shortcuts from the caller app. |
| ` https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#getShortcuts(int)(int matchFlags) ` Returns `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match `matchFlags`. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#isRateLimitingActive()() ` Return `true` when rate-limiting is active for the caller app. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#isRequestPinShortcutSupported()() ` Returns `true` if the app is running on a device whose default launcher supports `https://developer.android.com/reference/android/content/pm/ShortcutManager#requestPinShortcut(android.content.pm.ShortcutInfo,%20android.content.IntentSender)`. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#pushDynamicShortcut(android.content.pm.ShortcutInfo)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut) ` Publish a single dynamic shortcut. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#removeAllDynamicShortcuts()() ` Delete all dynamic shortcuts from the caller app. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#removeDynamicShortcuts(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds) ` Delete dynamic shortcuts by ID. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#removeLongLivedShortcuts(java.util.List<java.lang.String>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/java/lang/String> shortcutIds) ` Delete long lived shortcuts by ID. |
| ` void` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#reportShortcutUsed(java.lang.String)(https://developer.android.com/reference/java/lang/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. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#requestPinShortcut(android.content.pm.ShortcutInfo,%20android.content.IntentSender)(https://developer.android.com/reference/android/content/pm/ShortcutInfo shortcut, https://developer.android.com/reference/android/content/IntentSender resultIntent) ` Request to create a pinned shortcut. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo> shortcutInfoList) ` Publish the list of shortcuts. |
| ` boolean` | ` https://developer.android.com/reference/android/content/pm/ShortcutManager#updateShortcuts(java.util.List<android.content.pm.ShortcutInfo>)(https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo> shortcutInfoList) ` Update all existing shortcuts with the same IDs. |

### Inherited methods

From class `

https://developer.android.com/reference/java/lang/Object

` `


https://developer.android.com/reference/java/lang/Object` `
https://developer.android.com/reference/java/lang/Object#clone()()
`

Creates and returns a copy of this object.


`


boolean` `
https://developer.android.com/reference/java/lang/Object#equals(java.lang.Object)(https://developer.android.com/reference/java/lang/Object obj)
`

Indicates whether some other object is "equal to" this one.


`


void` `
https://developer.android.com/reference/java/lang/Object#finalize()()
`

Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.


`


final

https://developer.android.com/reference/java/lang/Class<?>` `
https://developer.android.com/reference/java/lang/Object#getClass()()
`

Returns the runtime class of this `Object`.


`


int` `
https://developer.android.com/reference/java/lang/Object#hashCode()()
`

Returns a hash code value for the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notify()()
`

Wakes up a single thread that is waiting on this object's
monitor.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#notifyAll()()
`

Wakes up all threads that are waiting on this object's monitor.


`


https://developer.android.com/reference/java/lang/String` `
https://developer.android.com/reference/java/lang/Object#toString()()
`

Returns a string representation of the object.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long,%20int)(long timeoutMillis, int nanos)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait(long)(long timeoutMillis)
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*, or until a
certain amount of real time has elapsed.


`


final

void` `
https://developer.android.com/reference/java/lang/Object#wait()()
`

Causes the current thread to wait until it is awakened, typically
by being *notified* or *interrupted*.


## Constants

### FLAG_MATCH_CACHED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_MATCH_CACHED
```

Include cached shortcuts in the result.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#getShortcuts(int)`

Constant Value:

8
(0x00000008)


### FLAG_MATCH_DYNAMIC

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_MATCH_DYNAMIC
```

Include dynamic shortcuts in the result.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#getShortcuts(int)`

Constant Value:

2
(0x00000002)


### FLAG_MATCH_MANIFEST

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_MATCH_MANIFEST
```

Include manifest shortcuts in the result.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#getShortcuts(int)`

Constant Value:

1
(0x00000001)


### FLAG_MATCH_PINNED

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public static final int FLAG_MATCH_PINNED
```

Include pinned shortcuts in the result.

<br />

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#getShortcuts(int)`

Constant Value:

4
(0x00000004)


## Public methods

### addDynamicShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean addDynamicShortcuts (List<ShortcutInfo> shortcutInfoList)
```

Publish the list of dynamic shortcuts. If there are already dynamic or pinned shortcuts with
the same IDs, each mutable shortcut is updated.

This API will be rate-limited.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `shortcutInfoList` | `List`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the call has succeeded. `false` if the call is rate-limited. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `https://developer.android.com/reference/android/content/pm/ShortcutManager#getMaxShortcutCountPerActivity()` is exceeded, or when trying to update immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### createShortcutResultIntent

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public Intent createShortcutResultIntent (ShortcutInfo shortcut)
```

Returns an Intent which can be used by the default launcher to pin a shortcut containing the
given `https://developer.android.com/reference/android/content/pm/ShortcutInfo`. This method should be used by an Activity to set a result in
response to `https://developer.android.com/reference/android/content/Intent#ACTION_CREATE_SHORTCUT`.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo`: New shortcut to pin. If an app wants to pin an existing (either dynamic or manifest) shortcut, then it only needs to have an ID, and other fields don't have to be set, in which case, the target shortcut must be enabled. If it's a new shortcut, all the mandatory fields, such as a short label, must be set. This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `https://developer.android.com/reference/android/content/Intent` | The intent that should be set as the result for the calling activity, or `null` if the current launcher doesn't support shortcuts. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if a shortcut with the same ID exists and is disabled. |

**See also:**

- `https://developer.android.com/reference/android/content/Intent#ACTION_CREATE_SHORTCUT`

### disableShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void disableShortcuts (List<String> shortcutIds)
```

Disable pinned shortcuts. For more details, read
[Disable shortcuts](https://developer.android.com/guide/topics/ui/shortcuts/managing-shortcuts#disable-shortcuts).

<br />

| Parameters ||
|---|---|
| `shortcutIds` | `List`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If trying to disable immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### disableShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void disableShortcuts (List<String> shortcutIds, 
                CharSequence disabledMessage)
```

Disable pinned shortcuts, showing the user a custom error message when they try to select
the disabled shortcuts.
For more details, read
[Disable shortcuts](https://developer.android.com/guide/topics/ui/shortcuts/managing-shortcuts#disable-shortcuts).

<br />

| Parameters ||
|---|---|
| `shortcutIds` | `List`: This value cannot be `null`. <br /> |
| `disabledMessage` | `CharSequence` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If trying to disable immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### enableShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void enableShortcuts (List<String> shortcutIds)
```

Re-enable pinned shortcuts that were previously disabled. If the target shortcuts
are already enabled, this method does nothing.

<br />

| Parameters ||
|---|---|
| `shortcutIds` | `List`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If trying to enable immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### getDynamicShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<ShortcutInfo> getDynamicShortcuts ()
```

Return all dynamic shortcuts from the caller app.

This API is intended to be used for examining what shortcuts are currently published.
Re-publishing returned `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s via APIs such as
`https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)` may cause loss of information such as icons.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### getIconMaxHeight

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getIconMaxHeight ()
```

Return the max height for icons, in pixels.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getIconMaxWidth

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getIconMaxWidth ()
```

Return the max width for icons, in pixels.

Note that this method returns max width of icon's visible part. Hence, it does not take
into account the inset introduced by `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable`. To calculate bitmap image
to function as `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable`, multiply
1 + 2 \* `https://developer.android.com/reference/android/graphics/drawable/AdaptiveIconDrawable#getExtraInsetFraction()` to the returned size.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getManifestShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<ShortcutInfo> getManifestShortcuts ()
```

Return all static (manifest) shortcuts from the caller app.

This API is intended to be used for examining what shortcuts are currently published.
Re-publishing returned `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s via APIs such as
`https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)` may cause loss of information such as icons.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### getMaxShortcutCountPerActivity

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public int getMaxShortcutCountPerActivity ()
```

Return the maximum number of static and dynamic shortcuts that each launcher icon
can have at a time.

<br />

| Returns ||
|---|---|
| `int` | <br /> |

### getPinnedShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<ShortcutInfo> getPinnedShortcuts ()
```

Return all pinned shortcuts from the caller app.

This API is intended to be used for examining what shortcuts are currently published.
Re-publishing returned `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s via APIs such as
`https://developer.android.com/reference/android/content/pm/ShortcutManager#setDynamicShortcuts(java.util.List<android.content.pm.ShortcutInfo>)` may cause loss of information such as icons.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### getShortcuts

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public List<ShortcutInfo> getShortcuts (int matchFlags)
```

Returns `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match `matchFlags`.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `matchFlags` | `int`: result includes shortcuts matching this flags. Any combination of: - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_MANIFEST` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_DYNAMIC` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_PINNED` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_CACHED` . Value is either `0` or a combination of the following: - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_MANIFEST` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_DYNAMIC` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_PINNED` - `https://developer.android.com/reference/android/content/pm/ShortcutManager#FLAG_MATCH_CACHED` |

| Returns ||
|---|---|
| `https://developer.android.com/reference/java/util/List<https://developer.android.com/reference/android/content/pm/ShortcutInfo>` | list of `https://developer.android.com/reference/android/content/pm/ShortcutInfo`s that match the flag. At least one of the `MATCH` flags should be set. Otherwise no shortcuts will be returned. This value cannot be `null`. |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### isRateLimitingActive

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isRateLimitingActive ()
```

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

For details, see [Rate limiting](https://developer.android.com/guide/topics/ui/shortcuts/managing-shortcuts#rate-limiting).

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### isRequestPinShortcutSupported

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean isRequestPinShortcutSupported ()
```

Returns `true` if the app is running on a device whose default launcher supports
`https://developer.android.com/reference/android/content/pm/ShortcutManager#requestPinShortcut(android.content.pm.ShortcutInfo,%20android.content.IntentSender)`.

Returns `false` if the default launcher does not support pinning, or if App Lock
is currently enabled for the calling app. App Lock is a feature that allows users to
require authentication before opening apps (see
`https://developer.android.com/reference/android/content/pm/PackageManager#getEnableAppLockIntentForPackage(java.lang.String,%20boolean)`). Applications
should re-query this method when returning to the foreground (e.g. in
`https://developer.android.com/reference/android/app/Activity#onResume()`) to update shortcut pinning UI.

The return value may change in subsequent calls if the user changes the default launcher
app.

**Note:** See also the support library counterpart
`https://developer.android.com/reference/androidx/core/content/pm/ShortcutManagerCompat.html#isRequestPinShortcutSupported(android.content.Context)`, which supports Android versions lower than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#O` using the
legacy private intent `com.android.launcher.action.INSTALL_SHORTCUT`.

<br />

| Returns ||
|---|---|
| `boolean` | <br /> |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#requestPinShortcut(android.content.pm.ShortcutInfo,%20android.content.IntentSender)`

### pushDynamicShortcut

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void pushDynamicShortcut (ShortcutInfo shortcut)
```

Publish a single dynamic shortcut. If there are already dynamic or pinned shortcuts with the
same ID, each mutable shortcut is updated.

This method is useful when posting notifications which are tagged with shortcut IDs; In
order to make sure shortcuts exist and are up-to-date, without the need to explicitly handle
the shortcut count limit.

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if trying to update an immutable shortcut. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

**See also:**

- `https://developer.android.com/reference/android/app/NotificationManager#notify(int,%20android.app.Notification)`
- `https://developer.android.com/reference/android/app/Notification.Builder#setShortcutId(java.lang.String)`

  `https://developer.android.com/reference/android/app/Notification.Builder#setShortcutId(java.lang.String)`

### removeAllDynamicShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeAllDynamicShortcuts ()
```

Delete all dynamic shortcuts from the caller app.

<br />

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### removeDynamicShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeDynamicShortcuts (List<String> shortcutIds)
```

Delete dynamic shortcuts by ID.

<br />

| Parameters ||
|---|---|
| `shortcutIds` | `List`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### removeLongLivedShortcuts

Added in [API level 30](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void removeLongLivedShortcuts (List<String> shortcutIds)
```

Delete long lived shortcuts by ID.

<br />

| Parameters ||
|---|---|
| `shortcutIds` | `List`: This value cannot be `null`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### reportShortcutUsed

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public void reportShortcutUsed (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.
For more details, read about
[tracking shortcut usage](https://developer.android.com/guide/topics/ui/shortcuts/managing-shortcuts#track-usage).

The information is accessible via `https://developer.android.com/reference/android/app/usage/UsageStatsManager#queryEvents(android.app.usage.UsageEventsQuery)`
Typically, launcher apps use this information to build a prediction model
so that they can promote the shortcuts that are likely to be used at the moment.

<br />

| Parameters ||
|---|---|
| `shortcutId` | `String` <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### requestPinShortcut

Added in [API level 26](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean requestPinShortcut (ShortcutInfo shortcut, 
                IntentSender resultIntent)
```

Request to create a pinned shortcut. The default launcher will receive this request and
ask the user for approval. If the user approves it, the shortcut will be created, and
`resultIntent` will be sent. If a request is denied by the user, however, no response
will be sent to the caller.

Only apps with a foreground activity or a foreground service can call this method.
Otherwise, it'll throw `https://developer.android.com/reference/java/lang/IllegalStateException`.

It's up to the launcher to decide how to handle previous pending requests when the same
package calls this API multiple times in a row. One possible strategy is to ignore any
previous requests.

**Note:** See also the support library counterpart
`https://developer.android.com/reference/androidx/core/content/pm/ShortcutManagerCompat.html#requestPinShortcut(android.content.Context,%20androidx.core.content.pm.ShortcutInfoCompat,%20android.content.IntentSender)`,
which supports Android versions lower than `https://developer.android.com/reference/android/os/Build.VERSION_CODES#O` using the
legacy private intent `com.android.launcher.action.INSTALL_SHORTCUT`.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `shortcut` | `ShortcutInfo`: Shortcut to pin. If an app wants to pin an existing (either static or dynamic) shortcut, then it only needs to have an ID. Although other fields don't have to be set, the target shortcut must be enabled. If it's a new shortcut, all the mandatory fields, such as a short label, must be set. This value cannot be `null`. |
| `resultIntent` | `IntentSender`: If not null, this intent will be sent when the shortcut is pinned. Use `https://developer.android.com/reference/android/app/PendingIntent#getIntentSender()` to create an `https://developer.android.com/reference/android/content/IntentSender`. To avoid background execution limits, use an unexported, manifest-declared receiver. For more details, see [Creating pinned shortcuts](https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#pinned). <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the launcher supports this feature. Note the API will return without waiting for the user to respond, so getting `true` from this API does \*not\* mean the shortcut was pinned successfully. `false` if the launcher doesn't support this feature or if calling app belongs to a user-profile with items restricted on home screen. If App Lock is enabled for the calling app, shortcut pinning requests will be rejected and this method will return `false`. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if a shortcut with the same ID exists and is disabled. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | The caller doesn't have a foreground activity or a foreground service, or the device is locked. |

**See also:**

- `https://developer.android.com/reference/android/content/pm/ShortcutManager#isRequestPinShortcutSupported()`
- `https://developer.android.com/reference/android/content/IntentSender`
- `https://developer.android.com/reference/android/app/PendingIntent#getIntentSender()`

### setDynamicShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean setDynamicShortcuts (List<ShortcutInfo> shortcutInfoList)
```

Publish the list of shortcuts. All existing dynamic shortcuts from the caller app
will be replaced. If there are already pinned shortcuts with the same IDs,
the mutable pinned shortcuts are updated.

This API will be rate-limited.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `shortcutInfoList` | `List`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the call has succeeded. `false` if the call is rate-limited. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | if `https://developer.android.com/reference/android/content/pm/ShortcutManager#getMaxShortcutCountPerActivity()` is exceeded, or when trying to update immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |

### updateShortcuts

Added in [API level 25](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)

```
public boolean updateShortcuts (List<ShortcutInfo> shortcutInfoList)
```

Update all existing shortcuts with the same IDs. Target shortcuts may be pinned and/or
dynamic, but they must not be immutable.

This API will be rate-limited.


This method may take several seconds to complete, so it should
only be called from a worker thread.

<br />

| Parameters ||
|---|---|
| `shortcutInfoList` | `List`: This value cannot be `null`. <br /> |

| Returns ||
|---|---|
| `boolean` | `true` if the call has succeeded. `false` if the call is rate-limited. <br /> |

| Throws ||
|---|---|
| `https://developer.android.com/reference/java/lang/IllegalArgumentException` | If trying to update immutable shortcuts. |
| `https://developer.android.com/reference/java/lang/IllegalStateException` | when the user is locked. |