Search code examples
androidapiandroid-2.2-froyoandroid-2.0-eclair

How do decide which flavor of Android to develop an app for?


My research shows that Android 2.2 & 2.3 have the loin share of the market. But when developing an app should I keep the API level of the app 2.1 or go with 2.2+?

What factors are usually taken into consideration?


Solution

  • I use 2.1 (API 7) as target, and 1.6 (API 4) as min version.

    This covers most of the Android devices in use today.

    If I need to use some (optional)functionality from 2.2 or 2.3 I use it with reflection.

    Here is example:

        // try to override the transition animation
        if (VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
          try {
            Method method = getClass().getMethod("overridePendingTransition",
                new Class[]{int.class, int.class});
            method.invoke(this, 0, 0);
          } catch (Throwable e) {
            // can not override transition animation, so do nothing
          }
        }