Fix activity not found
This commit is contained in:
parent
aa2a763736
commit
b1f4da214b
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