Merge pull request #4609 from osmandapp/market_crash

Fix activity not found
This commit is contained in:
vshcherb 2017-10-18 12:55:33 +02:00 committed by GitHub
commit a2b1662b92

View file

@ -27,10 +27,19 @@ public class Version {
return isGooglePlayEnabled(ctx) || isAmazonEnabled(ctx);
}
public static boolean isGooglePlayInstalled(OsmandApplication ctx) {
try {
ctx.getPackageManager().getPackageInfo("com.android.vending", 0);
} catch (PackageManager.NameNotFoundException e) {
return false;
}
return true;
}
public static String marketPrefix(OsmandApplication ctx) {
if (isAmazonEnabled(ctx)) {
return "amzn://apps/android?p=";
} else if (isGooglePlayEnabled(ctx)) {
} else if (isGooglePlayEnabled(ctx) && isGooglePlayInstalled(ctx)) {
return "market://details?id=";
}
return "https://osmand.net/apps?id=";