How do I differentiate between a system app and a normal app ? I looked through android PackageManager
and could not find any.
Edit: I want to differentiate via code.
if(system app) {
//do something
}
else{
//do nothing
}
A user can uninstall such applications normally from the Settings application. One can check if an application is a System application or not using “ApplicationInfo. FLAG_SYSTEM”.
Just search for the app on the Play Store and click on the Install button. You can install it either as system apps or as user apps. System apps are pre-installed apps in the system partition with your ROM. In other words, a system app is simply an app placed under '/system/app' folder on an Android device.
You could try using the flags available in the ApplicationInfo class (android.conent.pm). For example:
...
PackageManager pm = getPackageManager();
List<ApplicationInfo> installedApps = pm.getInstalledApplications(0);
for (ApplicationInfo ai: installedApps) {
if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
// System app - do something here
...
} else {
// User installed app?
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With