How to find installed applications in Android?

限于喜欢 提交于 2019-12-01 09:21:45
Nitin

This will do the trick...cheers :)

PackageManager pm = getPackageManager();
List<PackageInfo> list = pm.getInstalledPackages(0);

for (PackageInfo pi : list) {
   ApplicationInfo ai;
   try {
      ai = pm.getApplicationInfo(pi.packageName, 0);
      System.out.println(">>>>>>packages is<<<<<<<<" + ai.publicSourceDir);

      // this condition if satisfied means the application currently refered by ai
      // variable is
      // a system application
      if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
         Log.d(getClass().getSimpleName(), ">>>>>>packages is system package" + pi.packageName);
       }
    } catch (NameNotFoundException e) {
        Log.d(getClass().getSimpleName(), "Name not found", e);
    }
}

Goto DDMS Perspective ---> Click on the Emulator or Device ---> Check File Explorer ---> data --> data folder ---> there will be app names installed, note their package name :)

Hope it helps

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!