0

Probably this question may seem too broad. But I need to develop an app browser i.e I need my app to have a button and on clicking that button it should list all the installed apps on my phone and on selecting any app , my app should in turn open that app. I have read that if we know the package and class name of the app, we can open the app. Could you please help me how to go about doing this app? Or is it even possible?

Thanks

user2349990
  • 386
  • 4
  • 19

1 Answers1

2

If you want to create custom Launcher then -

Take install app List,Take gridView or ListView wherever you want to display your app,Create custom adapter to display icon and name to ListView

For getting installed app list-

    PackageManager pm = getPackageManager();
    List<ApplicationInfo> installedApps = context.getPackageManager()
            .getInstalledApplications(PackageManager.PERMISSION_GRANTED);

    for (ApplicationInfo apps : installedApps) {
        if (context.getPackageManager().getLaunchIntentForPackage(apps.packageName) != null) {
    //for app Name          
   appList.add((String)pm.getApplicationLabel(apps).toString());
    //For app Package Name  
           appPackage.add(apps.packageName); //appList and appPackage is arraylist

        }
    }

For Creating Icon

 Drawable icon = getPackageManager().getApplicationIcon("Your.Package.Name");

change this drawable to Bitmap if you want to use icon as a bitmap.

For launching app use Intent and Package Manager-

  PackageManager pm = getPackageManager();
        Intent appStartIntent = pm.getLaunchIntentForPackage("Your.Package.Name");
        if (appStartIntent != null) {
            startActivity(appStartIntent);
        }
T_V
  • 17,440
  • 6
  • 36
  • 48