Umer Pasha Blogs

www.umerpasha.com

Listing installed APKs in an Android system

Following code lists all the APKs installed in the Android System. I have checked this with ICS 4.0.1 and works fine. Pre-installed applications are in /system/app folder. User installed applications are in /data/app. Though this mostly works, user installed applications will probably only show up if you have a rooted device.



________________________________________________________
 public class Testing extends Activity {
    private static final String TAG = "TEST";
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
        File appsDir = new File("/data/app");

        String[] files = appsDir.list();

        for (int i = 0 ; i < files.length ; i++ ) {
            Log.d(TAG, "File: "+files[i]);

        }
    }

________________________________________________________
 
Advertisements
Leave a comment »