Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to get a list of installed apps on Android device

I am trying to make a simple Android Launcher. Through a tutorial and some other stack overflow posts I found this method of getting the list of installed apps:

        Intent intent = new Intent(Intent.ACTION_MAIN, null);
        intent.addCategory(Intent.CATEGORY_LAUNCHER);
        List<ResolveInfo> rawAppList = getApplicationContext()
                                        .getPackageManager()
                                        .queryIntentActivities( mainIntent, 0);

However, when I try to run this, I only get a list of 4 apps. The emulator I’m using to test has 14 apps displayed through the default launcher. Ideally, I would be able to see all of these in my own launcher.

I’ve tried cloning a git project which gets installed apps in the same way. When running it on the same emulator all 14 apps are retrieved as expected.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

So clearly there’s something I’ve done wrong, but I can’t figure out what it is. As far as I can tell, the tutorial I watched has no extra steps. There doesn’t seem to be any extra steps suggested in any of the other stack overflow posts I’ve seen either.

Can anyone spot what I’m doing wrong here?

>Solution :

To comply with package visibility rules, you will need a <queries> element as a child of the root <manifest> element:

<queries>
    <intent>
        <action android:name="android.intent.action.MAIN" />
        <category android:name="android.intent.action.LAUNCHER" />
    </intent>
</queries>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading