Android 7.1 Static Shortcut

My shiny Pixel has arrived, heres a quick example on how to add a static shortcut to an app.

“Never taken a shortcut before?”

Static shortcuts are defined in xml. So whack your xml in /res/xml/shortcuts.xml

<shortcuts xmlns:android="">
android:targetClass="" />
<!-- Specify more shortcuts here. -->

Its all pretty straight forward, in the example I’m using a custom action so that I can check inside the activity for the intent (“”).

Next up we need to add a reference to this new xml file in the AndroidManifest. Add this just after your intent-filter in your main activity, before the closing </activity>

<meta-data android:name=""
android:resource="@xml/shortcuts" />

Now to handle the shortcut. In the activity you’re starting add a new constant for the custom intent action.

private static final String ACTION_QUICKSTART = "";

Inside the onCreate method, check the intent for the custom intent action and do your thing…

if (ACTION_QUICKSTART.equals(getIntent().getAction())){

Hey presto, a simple app shortcut

Flutter Fan Boy & Android Developer

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store