Warpzit
Warpzit

Reputation: 28162

Is disabling an application for the new Android versions possible?

Is disabling an application for newer Android versions (e.g. 4.2 and higher) possible?

I've got an application that Google has rendered useless from 4.2; I don't want users use/install it when they are using Android 4.2 or higher.

Upvotes: 3

Views: 201

Answers (2)

Geobits
Geobits

Reputation: 22342

It depends on what exactly you want. According to the documentation for the deprecated maxSdkVersion:

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.

So, users could still sideload the app, but it will not appear in Google Play for users above that level. That sounds like what you want. There is no way(since 2.0.1) to completely disable sideloads.


Regarding this note about compilation:

...and the SDK will not compile if maxSdkVersion is set in an app's manifest.

I had my doubts. After testing it just now, my Eclipse/ADT compiles just fine with maxSdkVersion=15 set. So I wouldn't worry about that.


The answers regarding targetSdkVersion are fine for some things, but if you're using something that was intentionally broken/changed in a newer API, they won't work at all. For example, no amount of compatibility mode will allow 4.2+ to turn airplane mode on/off programmatically from within a non-root app. It also won't change the new implementation of SecureRandom.

If the app really is just completely useless for 4.2 because a key feature was removed, try using maxSdkVersion. Using a deprecated method always leaves me with a bad taste, but if they don't offer any sort of functional replacement, sometimes it's the only choice.

However, if you can work around it by changing how you accomplish <whatever>, that is by far the best solution.

Upvotes: 2

CodingRat
CodingRat

Reputation: 1944

Previously you could have set android:maxSdkVersion="integer" to 17 but after 2.1 it has been deprecated.

You can specify android:targetSdkVersion="Max_api_version_which_supported_by_your_app" to API Level: 16(4.1) below than 4.2

Upvotes: 0

Related Questions