in my app i have two set of designs. One design is for the android devices version of 2.1 and 2.2, the other design is for devices of 2.3 and above.
Now the problem is i take a build setting as follows in my manifest file
<uses-sdk android:minSdkVersion="7" />
<uses-sdk android:maxSdkVersion="8" />
My android project properties
in been set to 2.2
. When i run this build in 2.3.4 devices it gets run properly. How does it happens?
I am planning to submit the app with multiple apk files in market. How to block my apps
one build to be run in 2.1 and 2.2 and
the other build to get run in 2.3 and above
I just tried setting only <uses-sdk android:minSdkVersion="7" />
or <uses-sdk android:maxSdkVersion="7" />
or <uses-sdk android:maxSdkVersion="8" />
or
<uses-sdk android:targetSdkVersion="8" />
then also it gets run in all devices of 2.3.4 devices
Please help me friends....
You can install it using the adb or directly downloading the apk through a website.
The minSdk and maxSdkVersion is checked only when its installed from Android market. Devices with versions out of this range will not see your app in the market.
Hey as per the android documentation :
Introduced in: API Level 4
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.
You might want to have a look at last few lines of this link
EDIT1:
Also have a look at the Warning
Warning: Declaring this attribute is not recommended. First, there is no need to set the attribute as means of blocking deployment of your application onto new versions of the Android platform as they are released. By design, new versions of the platform are fully backward-compatible. Your application should work properly on new versions, provided it uses only standard APIs and follows development best practices. Second, note that in some cases, declaring the attribute can result in your application being removed from users' devices after a system update to a higher API Level. Most devices on which your application is likely to be installed will receive periodic system updates over the air, so you should consider their effect on your application before setting this attribute.
According to documentation:
Future versions of Android (beyond Android 2.0.1) will no longer check or enforce the maxSdkVersion attribute during installation or re-validation
http://developer.android.com/guide/topics/manifest/uses-sdk-element.html#max
Alternatively, you can check API version at runtime and block the use of your app.
http://developer.android.com/reference/android/os/Build.VERSION.html
You need to use PackageManager Class for Version Specific Application. There is a method called getPackageInfo()
which returns an object of PackageInfo
. From this PackageInfo
, you can fetch values of Version Name & Code.
Now you have values, so use logic and implement it