setDynamicShortcuts
open fun setDynamicShortcuts(@NonNull context: Context, @NonNull shortcutInfoList: List<ShortcutInfoCompat>): Boolean(source)
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.
On API <= 31 Any shortcuts that are marked as excluded from launcher will not be passed to the ShortcutManager, but they might still be available to assistant and other surfaces through alternative means.
This API will be rate-limited. Compatibility behavior:
- API 25 and above, this method matches platform behavior.
- API 24 and earlier, this method is equivalent of calling removeAllDynamicShortcuts and addDynamicShortcuts consecutively.
Return
true
if the call has succeeded. false
if the call is rate-limited.
Throws
if getMaxShortcutCountPerActivity is exceeded, or when trying to update immutable shortcuts.
when the user is locked.