Merge pull request #4609 from osmandapp/market_crash
Fix activity not found
This commit is contained in:
commit
a2b1662b92
1 changed files with 10 additions and 1 deletions
|
@ -26,11 +26,20 @@ public class Version {
|
|||
public static boolean isMarketEnabled(OsmandApplication ctx) {
|
||||
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=";
|
||||
|
|
Loading…
Reference in a new issue