我的研究表明Android 2.2 &2.3占有最大的市场份额但在开发应用时,我应该保持应用2.1的API级别还是使用2.2+?
通常要考虑哪些因素?
我使用2.1 (API 7)作为目标版本,1.6 (API 4)作为最小版本。
这涵盖了目前使用的大多数Android设备。
如果我需要使用2.2或2.3中的一些(可选的)功能,我会将其与反射一起使用。
示例:
// try to override the transition animation
if (VERSION.SDK_INT > android.os.Build.VERSION_CODES.DONUT) {
try {
Method method = getClass().getMethod("overridePendingTransition",
new Class[]{int.class, int.class});
method.invoke(this, 0, 0);
} catch (Throwable e) {
// can not override transition animation, so do nothing
}
}
我的答案很简单:从SDK4 (Android 1.6)开始,早期版本缺乏几个重要的功能(最明显的是屏幕尺寸处理),并且积累了许多未修复的错误。然后检查你的应用是否需要更新的Android版本功能,比如云到设备通知或气压计支持。
尽量不要在发布日期削减太多的用户,Android平台统计将帮助你:http://developer.android.com/resources/dashboard/platform-versions.html