pushDynamicShortcut

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.

Return

true if the call has succeeded. false if the call fails or is rate-limited.

See also

If getMaxShortcutCountPerActivity is already reached, an existing shortcut with the lowest rank will be removed to add space for the new shortcut.

If the rank of the shortcut is not explicitly set, it will be set to zero, and shortcut will be added to the top of the list. Compatibility behavior:

  • API 30 and above, this method matches platform behavior.
  • API 25 to 29, this api is simulated by addDynamicShortcuts and removeDynamicShortcuts and thus will be rate-limited.
  • API 24 and earlier, this method uses internal implementation and matches platform behavior.

Throws

if trying to update an immutable shortcut.

when the user is locked.