Updating apk only for specific version

582 Views Asked by At

EDIT: The question statement was not the correct, so I have updated it.

I have uploaded an Android app on Play Store. Now want to make a change in my android app and thus update it for the users. But I want the update to be available only to users of a particular version of android (say users with API 14 or higher).

2

There are 2 best solutions below

1
On

Set:

<uses-sdk android:minSdkVersion="14" android:targetSdkVersion="19"/>

In your Android Manifest

Edit:
Yes, that would need to have a different build. If you want t have only one apk and have certain features to only appear in Android Api 14+.

You can check at runtime like this (requires Api 4):

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH){

If you are supporting Api below 4. Use this instead:

if(Integer.parseInt(android.os.Build.VERSION.SDK)>=14){

(Note: this is deprecated)

0
On

in code

if (Build.VERSION.SDK_INT >= Build.VERSIOS_CODES.ICE_CREAM_SANDWICH) {
    do stuff
} else {
    do old stuff
}

in resources

res/layout-v14/layout_for_v14_and_higher.xml
res/values-v14/values_for_v14_and_higher.xml
res/drawable-v14-hdpi/drawable_new.png