In Android 7.1, there are app shortcuts ("quickcuts") that can be defined as intents in a shortcuts.xml resources file that is then referenced in a meta-data tag of the app's AndroidManifest.xml file. An Action Launcher application can then use the "static shortcut" intents to launch an app with a specific activity defined in the intent. From Java code executing at runtime, how would I obtain all such static shortcut intents defined in an arbitrary app's AndroidManifest.xml and shortcuts.xml resources file?
Asked
Active
Viewed 625 times
1

aoeu
- 1,128
- 2
- 13
- 22
-
I've never worked directly with them, so I can't post code, but it uses the `LauncherApps` class. I can't find how to get one thou https://developer.android.com/reference/android/content/pm/LauncherApps.html – Budius Dec 12 '16 at 18:24
-
found it. You call `getSystemService(Context.LAUNCHER_APPS_SERVICE)` and query with `getShortcuts`. – Budius Dec 12 '16 at 18:37
1 Answers
0
You mean you want to get the static shortcuts on your runtime code ?
Maybe you can refer to the code as below, I hope this can help u
ShortcutManager shortcutManager = getSystemService(ShortcutManager.class);
List<ShortcutInfo> infos=shortcutManager.getManifestShortcuts();
for(ShortcutInfo info : infos){
info.getId());
info.getLongLabel());
}

Vaycent
- 96
- 6