Whether the app installed is called Google Play or Market, the package name is the same com.android.vending
.
I need to be able to detect whether the app
I figured out how to check the application label. I was using the debugger to see what all was being returned in packageInfo
that's why I didn't see it initially.
public static boolean isGooglePlayInstalled(Context context) {
PackageManager pm = context.getPackageManager();
boolean app_installed = false;
try
{
PackageInfo info = pm.getPackageInfo("com.android.vending", PackageManager.GET_ACTIVITIES);
String label = (String) info.applicationInfo.loadLabel(pm);
app_installed = (label != null && !label.equals("Market"));
}
catch (PackageManager.NameNotFoundException e)
{
app_installed = false;
}
return app_installed;
}