How do I obtain Intents for static shortcuts (quickcuts) of all installed apps at runtime?

662 Views Asked by At

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?

1

There are 1 best solutions below

0
On

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());
    }