Is there any way to check if the particular application is already installed in device ? May be through some package name ?
Regards
try like this:
public void checkApplication(String packageName) {
PackageManager packageManager = getPackageManager();
ApplicationInfo applicationInfo = null;
try {
applicationInfo = packageManager.getApplicationInfo(packageName, 0);
} catch (NameNotFoundException e) {
e.printStackTrace();
}
if (applicationInfo == null) {
// not installed
} else {
// Installed
}
}
check this:
add packagename
in targetPackage
of checking application .
public boolean isPackageExisted(String targetPackage){
List<ApplicationInfo> packages;
PackageManager pm;
pm = getPackageManager();
packages = pm.getInstalledApplications(0);
for (ApplicationInfo packageInfo : packages) {
if(packageInfo.packageName.equals(targetPackage)) return true;
}
return false;
}