2

If I know an apps package name, how can I get a list of all available app shortcuts?

I can get my own apps shortcuts with the ShortcutManager like described here https://developer.android.com/guide/topics/ui/shortcuts.html, but how do I get a list of another apps shortcuts?

prom85
  • 16,896
  • 17
  • 122
  • 242

1 Answers1

3

The only app that has access to other apps shortcuts is the default launcher, as determined by hasShortcutHostPermission().

For the default launcher app, they can use getShortcuts() to get the list of shortcuts.

ianhanniballake
  • 191,609
  • 30
  • 470
  • 443
  • This means, for a sidebar like app it's impossible to get those shortcuts? Thanks though, this answers my question. – prom85 Jan 15 '18 at 21:57
  • 1
    That's correct, yes. Not even non-default launchers can get the shortcuts. – ianhanniballake Jan 15 '18 at 22:18
  • Note that this is true for dynamic shortcuts. Static shortcuts are just `` entries and are public to anyone who wants to rummage through the `PackageManager`. – CommonsWare Jan 15 '18 at 22:35
  • Static shortcuts would already be enough for me, as even this is a feature I would like to implement. Will I have to parse the manifest manually (like I do it to retrieve an icon packs image definitions for example) or is there a way to retrieve the desired intents from the `PackageManager`? I can't use the `LauncherApps` service for this if I understant that correctly – prom85 Jan 16 '18 at 05:59
  • I've opened a feature request on the issue tracker https://issuetracker.google.com/issues/256148980 – Fossor Nov 08 '22 at 11:26