Search code examples
androidandroid-shortcut

What "android.shortcut.conversation" means in shortcuts.xml?


<shortcuts xmlns:android="http://schemas.android.com/apk/res/android">
  <shortcut
    android:shortcutId="compose"
    android:enabled="true"
    android:icon="@drawable/compose_icon"
    android:shortcutShortLabel="@string/compose_shortcut_short_label1"
    android:shortcutLongLabel="@string/compose_shortcut_long_label1"
    android:shortcutDisabledMessage="@string/compose_disabled_message1">
    <intent
      android:action="android.intent.action.VIEW"
      android:targetPackage="com.example.myapplication"
      android:targetClass="com.example.myapplication.ComposeActivity" />
    <!-- This -->
    <categories android:name="android.shortcut.conversation" />
  </shortcut>
</shortcuts>

What other value is available? Do I need to include this category and what if I delete it?

I did not find this in the official documentation - https://developer.android.com/guide/topics/ui/shortcuts.html


Solution

  • categories tag is used to provide a grouping for the types of actions that your app's shortcuts perform. One of the available groups is android.shortcut.conversation, and this is used if you want to add a shortcut to conversation of chat application. For example, a shortcut to the most recent chat head. You would only need to add this in your shortcuts.xml, when you want to provide the said shortcut. Otherwise you don't need it. You can delete it. For API level 26 or lower this is the only value that is avaliable. But for higher versions there are multiple.

    For a list of supported shortcut categories you can see this page.