Created
February 14, 2012 14:29
-
-
Save Draiken/1827092 to your computer and use it in GitHub Desktop.
market compatible
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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