I use the following code to distinguish between a user-installed and a system application:
final PackageManager pm = getPackageManager();
List<ApplicationInfo> packages = pm.getInstalledApplications(PackageManager.GET_META_DATA);
for (ApplicationInfo packageInfo : packages)
{
if ((packageInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0)
Log.d(TAG, "Installed package (System) :" + packageInfo.packageName);
else
Log.d(TAG, "Installed package (User) :" + packageInfo.packageName);
}
Be that as it may, this gives some applications as user-installed applications that are not really there. Below is the LogCat in the emulator:
Installed package (User) :com.android.smoketest
Installed package (User) :com.android.widgetpreview
Installed package (User) :com.example.android.livecubes
Installed package (User) :com.example.android.apis
Installed package (User) :com.android.gesture.builder
Installed package (User) :com.example.android.softkeyboard
Installed package (User) :com.android.smoketest.tests
Installed package (User) :faheem.start
Ideally, only the latest application should be displayed in applications installed by the user.
source
share