CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET constant
The accessibility shortcut is a global gesture for users with disabilities to trigger an important for them accessibility feature to help developers determine whether they want to make their activity a shortcut target.
An activity of interest to users with accessibility needs may request to be the target of the accessibility shortcut. It handles intent {@link #ACTION_MAIN} with this category, which will be dispatched by the system when the user activates the shortcut when it is configured to point at this target.
An activity declared itself to be a target of the shortcut in AndroidManifest.xml. It must also do two things:
-
Specify that it handles the
android.intent.action.MAIN
{@link android.content.Intent}
with category android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET.
-
Provide a meta-data entry
android.accessibilityshortcut.target in the
manifest when declaring the activity.
<activity android:name=".MainActivity"
. . .
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET" />
</intent-filter>
<meta-data android:name="android.accessibilityshortcut.target"
android:resource="@xml/accessibilityshortcut" />
</activity>
This is a sample XML file configuring a accessibility shortcut target:
<accessibility-shortcut-target
android:description="@string/shortcut_target_description"
android:summary="@string/shortcut_target_summary"
android:animatedImageDrawable="@drawable/shortcut_target_animated_image"
android:htmlDescription="@string/shortcut_target_html_description"
android:settingsActivity="com.example.android.shortcut.target.SettingsActivity" />
Both description and summary are necessary. The system will ignore the accessibility shortcut target if they are missing. The animated image and html description are supported to help users understand how to use the shortcut target. The settings activity is a component name that allows the user to modify the settings for this accessibility shortcut target.
Implementation
static const String CATEGORY_ACCESSIBILITY_SHORTCUT_TARGET =
"android.intent.category.ACCESSIBILITY_SHORTCUT_TARGET";