Shortcuts in Android

Shobhith J B
3 min readApr 3, 2022

--

Hello contrivers, In this article I am going to give a quick introduction of Android shortcuts. As this is just an introduction article, I am not deep diving into Types of shortcuts here.

Vroom Vroom….Let’s gooo………

Shortcuts in Android…..

In general, shortcut is an alternative route that is shorter than the one usually taken or means of doing something more directly and quickly than ordinary procedure.

Android shortcuts are also created with the same intention. i.e., to ease the procedure of performing any action.

Android introduced shortcuts to perform some actions on our apps.

As the shortcuts are displayed in a supported launcher or assistant, like Google Assistant, it will help users to quickly and easily perform common tasks within our app without navigating to the screen where it contains the actual action to be performed.

Still haven’t understood? Let me give you an example……

Choose any app like whatsapp, instagram or camera app. Long press on the app icon. Some apps will display a popup dialog. The popup dialog contains options such as Camera, Contact Names in case of Whatsapp; Camera,New Post,View activity, Chats in case of Instagram; Video, Photo in case of Camera App. The options in these popups are called as shortcuts.

These options in the popup may vary for different apps and for different users.

Let’s see some of the actions that we can perform with shortcuts,

Shortcut Examples

➼ Composing new email in an email app.

➼ Sending message to a friend in a messaging app.

➼ Ordering food in delivery app using voice command.

➼ Adding a new post in a social media app.

➼ Opening new tab in web browser app.

➼ Sending money in Banking app.

All these examples and many more actions can be performed from launcher icon or using assistants directly and quickly without actually navigating to the screen where it has these actions.

Types of Shortcuts

Shortcuts are categorized into three types. They are,

Static Shortcuts

These type of shortcuts are defined in a resource file (xml file) that is packaged into an APK. These shortcuts are created and published once when the launcher activity is opened.

To learn how to create Static shortcut read the below docs,

Dynamic Shortcuts

These type of shortcuts are created,pushed,updated and removed by your app only at runtime using ShortcutManager API.

To learn how to create Dynamic shortcut read the below docs,

https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#dynamic

Pinned Shortcuts

Pinned Shortcuts are supported only in android version 8.0 and above. Unlike static or dynamic shortcuts pinned shortcuts appear as a separate icon in supported launchers at runtime only if the user grants the permission to do so.

To learn how to create Pinned shortcut read the below docs,

https://developer.android.com/guide/topics/ui/shortcuts/creating-shortcuts#pinned

Thank you for reading this article. Happy Coding 😊

Photo by Randy Tarampi on Unsplash

--

--

Shobhith J B

Native Android Developer | Kotlin | Java | Travel Enthusiast