Search code examples
androidandroid-4.0-ice-cream-sandwich

Differentiate between 4.0.3 and 4.0.4


Is there a way to differentiate between versions 4.0.3 and 4.0.4?

I've seen that VERSION_CODES.ICE_CREAM_SANDWICH_MR1 refers to both.


Solution

  • Use Build.VERSION.RELEASE to get the user-visible version String.

    http://developer.android.com/reference/android/os/Build.VERSION.html#RELEASE

    The user-visible version string. E.g., "1.0" or "3.4b5".

    So, for example:

    String version = Build.VERSION.RELEASE;
    Log.i(TAG, version);
    if (version.equals("4.0.3")) {
        // do something
    }
    else if (version.equals("4.0.4")) {
        // do something else
    }