Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Develop on Android 4.0, will it be compatible with 2.3 devices and all Tablets?

I have been making iphone applications for a while, but now want to start making them on android as well.

However i see that the new 4.0 is emerging and was wondering, as long as i do not use any functions that are only available on 4.0, can i use the 4.0 sdk to develop for all 4.0, 2.3 and tablet devices at the same time?

So i can make it compatible for all Tablet devices and all deices running 2.3 as well?

Thanks very much for all your help.

like image 969
ApiMail Avatar asked Jan 18 '23 00:01

ApiMail


2 Answers

If you want to do as you say have this in your manifest:

 <uses-sdk
    android:minSdkVersion="9"
    android:targetSdkVersion="15" />

This says you support from version 2.3.2 but are developing against 4.0.3.

This will work on all devices phone/tablet that run on Android >= 2.3.2.

Making it look good on all those devices is a different question altogether.

EDIT to explain min and target

midSdk is saying yes I support platform version 9 and any above it. So I can work with the Android system code on any v9 device and above. Combined with targetSdk it says I can run on a minimum of platform v9 but I'm telling you I've tested upto v15 so if you can do anything cool to help my app (like hardware graphics acceleration) then do it! because I've targeted that version. But I don't rely on hardware acceleration to work!

like image 66
Blundell Avatar answered Mar 05 '23 19:03

Blundell


In your application, you have 3 controls for the sdk version.

<uses-sdk android:minSdkVersion="integer" 
          android:targetSdkVersion="integer"
          android:maxSdkVersion="integer" />

The minSdkVersion sets the minimum api level that your application will be allowed to be installed on.

The targetSdkVersion is the sdk version that application will actually be built against.

maxSdkVersion is the same as minimum sdk version, but in general, it shouldn't be ever be used.

Every version of android is supposed to be backwards compatible, so often times the solution is to target the minimum sdk version. In your case, you could target 2.3, and your application would work fine on 4.0. However, if you do this, you won't be able to use any of the 4.0 specific API changes, a lot of which are tablet specific, and you will be missing out.

If you want to take advantage of 4.0 only features, you could either upload two separate apps to the market (much of the code base could be the same) as detailed by this blog post, or if it's very small sections of code, you could detect API version at runtime, as detailed in this stackoverflow question.

like image 40
JeffS Avatar answered Mar 05 '23 18:03

JeffS