Android Utililty Methods Device Version Check

List of utility methods to do Device Version Check

Description

The list of methods to do Device Version Check are organized into topic(s).

Method

intGetVersionCode(final Context con)
Get Version Code
int version = 1;
PackageManager packageManager = con.getPackageManager();
try {
    PackageInfo packageInfo = packageManager.getPackageInfo(
            con.getPackageName(), 0);
    version = packageInfo.versionCode;
} catch (Exception e) {
    e.printStackTrace();
...
StringGetVersionName(final Context context)
Get Version Name
String versionName = "1.0.0";
PackageManager packageManager = context.getPackageManager();
try {
    PackageInfo packageInfo = packageManager.getPackageInfo(
            context.getPackageName(), 0);
    versionName = packageInfo.versionName;
} catch (Exception e) {
    e.printStackTrace();
...
StringgetDefaultVendor()
Gets the default vendor for this build.
return Build.BRAND;
StringgetPhoneVersion()
get Phone Version
return Build.VERSION.RELEASE;
booleanisJellybeanOrLater()
is Jellybean Or Later
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
booleanisJellybeanOrLater()
is Jellybean Or Later
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN;
booleancheckIncVersion(String fingerprinter, String product)
check Inc Version
return (Build.FINGERPRINT.equals(fingerprinter) && (Build.DEVICE
        .equals(product) || Build.PRODUCT.equals(product)));
booleancheckVersion(long newVersion, String product)
check Version
return (Build.TIME <= newVersion * 1000 && (Build.DEVICE
        .equals(product) || Build.PRODUCT.equals(product)));
floatgetAndroidVersion()
get Android Version
if (sAndroidVersion == 0.0f) {
    String androidVersion = Build.VERSION.RELEASE.trim();
    try {
        int firstDotPosition = androidVersion.indexOf('.'), secondDotPosition = androidVersion
                .indexOf('.', firstDotPosition + 1);
        sAndroidVersion = Float
                .parseFloat(androidVersion
                        .substring(
...
booleanisGingerbread()
I guess this should really be named "isGingerbreadOrAbove()" but I suck at function naming.
return Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD;