I want to check whether an app is installed on the device or not. I am using code below :
PackageManager pm = context.getPackageManager();
List<PackageInfo> packageInfoList = pm.getInstalledPackages(PackageManager.GET_ACTIVITIES);
if (packageInfoList != null) {
for (PackageInfo packageInfo : packageInfoList) {
Log.d(TAG, "-->"+packageInfo.packageName);
String packageName = packageInfo.packageName;
if (packageName != null && packageName.equals(uri)) {
return true;
}
}
}
return false;
Which gives me all the packages but not the one that I except. I am trying to find this app : rootcloak and exposed installer Not able to find these apps with the code above.
just check using application id of particular app for example check
getPackageManager().getPackageInfo("com.facebook.katana", 0);
return true;
else false
check this answer it may helpful to you. How to check programmatically if an application is installed or not in Android?
Use Below Code:
Call the method like:
I found the answer here
This worked for me perfectly.
like whatsapp
shareImage("com.whatsapp", "Whatsapp");
call