Android: Check if application is installed
It attempts to fetch information about the package whose name you passed in. If you got failing result, if a NameNotFoundException
was thrown, it means that no package with that name is installed.
private boolean isPackageInstalled(String packageName, PackageManager packageManager) {
try {
packageManager.getPackageInfo(packagename, 0);
return true;
} catch…