tntv
tntv

Reputation: 118

Android Min SDK Version and Max SDK Version setting

I have an app which I want to install on ICS only . So i have set the min and max sdk versions as below.

<uses-sdk android:minSdkVersion="14" android:maxSdkVersion="15" />

Ideally this should work. But some how it is able to install on Jellybean version also. ICS(API 14-15) JellBean (API 16-18)

What am I Missing here? Please help

Upvotes: 6

Views: 14915

Answers (2)

A--C
A--C

Reputation: 36449

According to the documentation:

Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. Google Play will continue to use the attribute as a filter, however, when presenting users with applications available for download.

The behaviour seen is expected. However, if you publish to Google Play, the application will be filtered.

Unless you have some feature that absolutely requires only older APIs (airplane mode comes to mind), then such a limitation does not serve much purpose.

If you're concerned about non Google Play sources or users sideloading the app, you can always do a runtime check for the Android version and either restrict features or close the app.

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLYBEAN){
   //do something about the Android version being too new
}

Keep in mind that if you want your app to reach the largest userbase, you will have to address the issues caused by the new Android versions at some point.

Upvotes: 5

ianhanniballake
ianhanniballake

Reputation: 200120

Per the maxSdkVersion documentation:

Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation. Google Play will continue to use the attribute as a filter, however, when presenting users with applications available for download.

Filtering will still work from Google Play, but you can sideload the app onto any device with a higher SDK version than the minimum.

Upvotes: 1

Related Questions