Get list of all apps with QPython / sl4a

1.3k Views Asked by At

Does anyone know how I can get a list of packages from all apps installed on Android using Qpython?

My goal is to list all apps and be able to run, using getLaunchableApplications() and the "launch" function until I could open some, but it does not work for everyone. I made tests and if I get the name of the packages I should be able to open any app with startActivity().

2

There are 2 best solutions below

2
Kirk On

There's an executable pm(package manager) inside Android, use pm list packages to list installed packages. If you want to automate the query progress, subprocess.check_output(["pm","list","packages"]) may be a good way.

As for your second question--"launch the app", it has been answered here: Launch android app from SL4A script?

2
Mubarak Lawal On

here is a code to print out all launchable apps using the androidhelper module

import androidhelper
droid=androidhelper.Android()
launchable_app=droid.getLaunchableApplications()
print(launchable_app)

you can use pprint() instead of print() to get a readable format