1

I need to display a screen with all the installed applications. I can do this already, but I need to filter some of the system applications. I am doing like this:

if((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) == 1)

This works, but the problem is that it hides apps like System, Video Player, and Sound Recorder. However, I need these apps to show up, too. The question is, how to do this?

4

2 に答える 2

2

You'll have to filter them manually via their process-name, e.g.:

if(appInfo.packageName().equals("com.android.soundrecorder"))

Please post more of your code if this doesn't work!

于 2012-05-28T16:12:08.757 に答える
1

If an Application is a non-system application it must have a launch Intent by which it can be launched. If the launch intent is null then its a system App.

Example of System Apps: "com.android.browser.provider", "com.google.android.voicesearch".

For the above apps you will get NULL when you query for launch Intent.

PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for(ApplicationInfo packageInfo:packages){
    if( pm.getLaunchIntentForPackage(packageInfo.packageName) != null ){
                String currAppName = pm.getApplicationLabel(packageInfo).toString();
               //This app is a non-system app
    }
    else{
        //System App
    }
}
于 2013-08-19T20:17:40.770 に答える