Skip to content

Instantly share code, notes, and snippets.

@AOrobator
Created December 3, 2016 18:16
Show Gist options
  • Save AOrobator/0bf76a3f43aa6e8c1eff875a8d0b925c to your computer and use it in GitHub Desktop.
Save AOrobator/0bf76a3f43aa6e8c1eff875a8d0b925c to your computer and use it in GitHub Desktop.
Implementing App Shortcuts - shortcuts.xml
<?xml version="1.0" encoding="utf-8"?>
<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
<shortcut
android:enabled="true"
android:icon="@drawable/random_constellation"
android:shortcutDisabledMessage="@string/shortcut_disabled_message"
android:shortcutId="random_constellation"
android:shortcutLongLabel="@string/shortcut_long_label"
android:shortcutShortLabel="@string/shortcut_short_label">
<!-- Each one of these intents needs an android:action, even if you don't
do anything with it. Otherwise you're in for a crash! -->
<intent
android:action="android.intent.action.VIEW"
android:targetClass="com.orobator.konstellations.MainActivity"
android:targetPackage="com.orobator.konstellations"/>
<intent
android:action="RANDOM"
android:targetClass="com.orobator.konstellations.ConstellationDetailActivity"
android:targetPackage="com.orobator.konstellations"/>
<!-- If your shortcut is associated with multiple intents, include them
here. The last intent in the list is what the user sees when they
launch this shortcut. The previous intents will be put on the backstack -->
<!-- You can also specify the category of the shortcut via the <categories>
tag. As of this writing, the only supported category is
android.shortcut.conversation, and can be specified using android:name
like so: -->
<!-- <categories android:name="android.shortcut.conversation"/> -->
</shortcut>
</shortcuts>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment