Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

android - 2 app versions for different API levels

I'm currently developing an app (minimum SDK 14) using many of the new APIs. Looking at some Google statistics made me think things over - about 35% of devices still run Android versions less than 4 (2.3 Gingerbread in most cases). Since I don't want to lose customers, I started to think about adding android 4- support, but I'd need to completely re-work the app for that.

So I thought about creating an extra version, fully optimized for SDK 9-10, whilst the other will be fully optimized for android 4.0 and above. Since I have minSDK and maxSDK options available in the Manifest, I can ensure that any user will only see the appropriate version on the Play Store. What do you think about such approach, any disadvantages (except for investing more time) that I didn't see?

like image 441
Droidman Avatar asked Mar 28 '26 16:03

Droidman


1 Answers

When the user upgrades their version of Android, how do they know to look for a new version of your app?

It's possible to adapt at runtime to the android version on the device.

switch(Build.VERSION.SDK_INT)
{
   case Build.VERSION_CODES.HONEYCOMB: 
...
}

And you can use Android Version as one of the criteria for selecting resources.

res/layout-v12
  ...

Also you may need to annotate some methods to avoid compiler warnings/errors:

@TargetApi(Build.VERSION_CODES.FROYO)

In my opinion using these techniques is easier and more reliable than supporting separate source trees.

like image 50
Dale Wilson Avatar answered Mar 30 '26 07:03

Dale Wilson



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!