How to get the names of applications visible on the main screen in Android?

I want to create a list of applications visible on the main screen in Android.

I am currently using the following code:

List<ApplicationInfo> packs = pm.getInstalledApplications(0); 

But this returns all installed applications, but this requires only applications with icons on the main screen.

How can I do that?

Any help was appreciated.

+6
source share
1 answer

Now that you have a list of packages installed on your device, go through them and call getLaunchIntentForPackage() for each item.

If a valid intention is returned, it exists in Launcher; otherwise, if null is returned, the package does not start from the Launcher screen. Please note that shortcuts on the main screen are a subset of Launcher applications.

0
source

Source: https://habr.com/ru/post/902189/


All Articles