今天继续分享android的compatibility问题,原话题叫“Controlling Your App's Availability to Devices”。
开发者都希望一个apk能在千差万别的android手机上自由运行,android手机的千差万别,表现在android手机厂商的硬件支持、sdk的不同、屏幕尺寸等。如何在这些手机上运行得更加完美,Google提出了一些方案,官方内容如下:
Android supports a variety of features your app can leverage through platform APIs. Some features are hardware-based (such as a compass sensor), some are software-based (such as app widgets), and some are dependent on the platform version. Not every device supports every feature, so you may need to control your app's availability to devices based on your app's required features.
To achieve the largest user-base possible for your app, you should strive to support as many device configurations as possible using a single APK. In most situations, you can do so by disabling optional features at runtime and providing app resources with alternatives for different configurations (such as different layouts for different screen sizes). If necessary, however, you can restrict your app's availability to devices through Google Play Store based on the following device characteristics:
- Device features
- Platform version
- Screen configuration
- Device features
接下来的四节,我们讲这四种方案。