How to detect if Google Play is installed? (Not Market)
android, google-play
Solution
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;
}
Problem
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 is Google Play or Market, I've checked in PackageInfo and nothing except `versionCode` and `versionName` can be of help. Does anyone know what the first `versionCode` was or `versionName` was for Google Play app? If anyone knows any other way of detecting this let me know.