是否可以禁用较新 Android 版本(例如 4.2 及更高版本)的应用程序?
我有一个应用程序,谷歌从 4.2 开始就没用了;我不希望用户在使用 Android 4.2 或更高版本时使用/安装它。
最佳答案
这取决于你到底想要什么。根据documentation对于已弃用的 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.
因此,用户仍然可以旁加载该应用,但对于该级别以上的用户,它不会出现在 Google Play 中。这听起来像你想要的。没有办法(自 2.0.1 起)完全禁用侧载。
关于这个note about compilation :
...and the SDK will not compile if maxSdkVersion is set in an app's manifest.
我有疑问。在刚才测试之后,我的 Eclipse/ADT 编译得很好 maxSdkVersion=15
放。所以我不会为此担心。
关于 targetSdkVersion
的答案对于某些事情来说很好,但是如果您在较新的 API 中使用的是故意破坏/更改的东西,它们将根本无法工作。例如,再多的兼容模式也不允许 4.2+ 从非 root 应用程序中以编程方式打开/关闭飞行模式。它也不会改变 SecureRandom
的新实现。 .
如果应用程序真的因为删除了关键功能而对 4.2 完全无用,请尝试使用 maxSdkVersion
.使用已弃用的方法总是让我觉得不好,但如果他们不提供任何类型的功能替代,有时它是唯一的选择。
但是,如果您可以通过改变完成方式来解决这个问题 <whatever>
,这是迄今为止最好的解决方案。
关于android - 是否可以禁用新 Android 版本的应用程序?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18396568/