Widgets/Shortcuts

The new flow API for adding shortcuts and widgets in Android 8.0 allows
application developers to add shortcuts and widgets from inside the app instead
of relying on the widget tray. It also deprecates the old method (sending a
broadcast) of adding shortcuts for security reasons.

Launchers need to support this new implementation so that app developers can
rely on the system to add their shortcut or widget.

Examples and source

Docs are available in various system class. References include the following:

Validation

To validate the feature, try to add shortcuts from Chrome or the Contacts app
and verify that a proper confirmation prompt is shown. Upon accepting, the icon
should get added on the homescreen and Chrome should display a success toast.

Content and code samples on this page are subject to the licenses described in the Content License. Java is a registered trademark of Oracle and/or its affiliates.