Reputation: 89
Is there any way to create Android app for compatible for all API levels. When I searching this topic I have found most article say like this, eg: If I create app for level 16(4.1, 4.1.1), that app works only for that level and above levels. Is it true? and is there any possible way to create app compatible to all levels?
Also if I create app for Android 4.0.3 and level 15, does it work for 4.0.4?
Upvotes: 0
Views: 939
Reputation: 64837
When you specify a minimum version with android:minSdkVersion you're telling the framework and Play Store to hide the app from devices with lower API level.
When specify a target version with android:targetSdkVersion you're telling the framework that you'll be using framework features that are only available in that version and have made sure in the code that devices between the minimum and target version are properly handled (e.g. through version or feature checking).
The app will refuse to install/run when the API level of the device is lower than android:minSdkVersion. But the will present the app with compatibility later of the target version when the API level of the device is higher than android:targetSdkVersion, IOW, the device will pretend to be like the target version so you can't use features that are only available later than the target version.
If you want to make sure your devices supports all version of Android, then you can do so by setting minimum and target version to 1 (or as low as you can go), if you want to conditionally support additional feature for devices with higher API, then set a higher target version than minimum version, and make the necessary feature checks or shims code in your code yourself.
Upvotes: 0
Reputation: 9035
I think it is not only about mentioning
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
in your manifest, it also about how well you use the available libraries to make your app backward compact able.
The android:minSdkVersion
will be the lowest api level your app supports..
and android:targetSdkVersion
is the version you tested all the functionality of your app.(Keep in mind that you app will get installed on the devices with api level higher than targetSdkVersion) so it is a better practice to make targetSdkVersion to the latest api level.
But in order to make your app work great on all available api platforms use make better use of support libraries, actionbarSherlock or actionBarCompact libraries etc.. and also test your app in all possible versions, and make responsive layouts...
Upvotes: 1
Reputation: 6899
Simple.Just give this in manifest to support in all versions
<uses-sdk
android:minSdkVersion="8"
android:targetSdkVersion="17" />
Upvotes: 1