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
|
@ -27,10 +27,19 @@ public class Version {
|
||||||
return isGooglePlayEnabled(ctx) || isAmazonEnabled(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) {
|
public static String marketPrefix(OsmandApplication ctx) {
|
||||||
if (isAmazonEnabled(ctx)) {
|
if (isAmazonEnabled(ctx)) {
|
||||||
return "amzn://apps/android?p=";
|
return "amzn://apps/android?p=";
|
||||||
} else if (isGooglePlayEnabled(ctx)) {
|
} else if (isGooglePlayEnabled(ctx) && isGooglePlayInstalled(ctx)) {
|
||||||
return "market://details?id=";
|
return "market://details?id=";
|
||||||
}
|
}
|
||||||
return "https://osmand.net/apps?id=";
|
return "https://osmand.net/apps?id=";
|
||||||
|
|
Loading…
Reference in a new issue