Skip to content

Instantly share code, notes, and snippets.

@Draiken
Created February 14, 2012 14:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Draiken/1827092 to your computer and use it in GitHub Desktop.
Save Draiken/1827092 to your computer and use it in GitHub Desktop.
market compatible
public boolean isCompatible() {
String ver = getOsVersion();
// If it's null, we're not sure, so let the market handle it
if (ver == null)
return true;
String[] versions = getOsVersion().split("/");
String lowestVersion = versions[0];
String droidVersion = Build.VERSION.RELEASE.substring(0, 3);
try {
if (Float.parseFloat(lowestVersion) < Float.parseFloat(droidVersion))
return true;
} catch (NumberFormatException e) {
// Something went wrong, let market handle it
return true;
}
return false;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment