android API版本对应的系统版本及Android获取手机和系统版本等信息的代码
学了这么久的Android,竟然一直对其API对应的名称关系一值搞不清楚,现在网上认真看了下资料,转载一个觉得写得不错的作者的文章,记下来:
【背景】
之前折腾android期间,慢慢地知道了,Android的版本,有个API Level,其实就是对应着某个Android发布版本的名称。
现在去总结一下。
【折腾过程】
1.参考了:
Supporting Different Platform Versions
Codenames, Tags, and Build Numbers
总结如下:
Android版本名和API Level关系全称 |
Android的版本 |
Android版本名称Code name |
Android的API level |
Android 1.0 (API level 1) |
1.0 |
(no code name) |
API level 1 |
Android 1.1 (API level 2) |
1.1 |
(no code name) |
API level 2 |
Android 1.5 Cupcake (API level 3) |
1.5 |
Cupcake |
API level 3, NDK 1 |
Android 1.6 Donut (API level 4) |
1.6 |
Donut |
API level 4, NDK 2 |
Android 2.0 Eclair (API level 5) |
2.0 |
Eclair |
API level 5 |
Android 2.0.1 Eclair (API level 6) |
2.0.1 |
Eclair |
API level 6 |
Android 2.1 Eclair (API level 7) |
2.1 |
Eclair |
API level 7, NDK 3 |
Android 2.2–2.2.3 Froyo (API level 8) |
2.2.x |
Froyo |
API level 8, NDK 4 |
Android 2.3–2.3.2 Gingerbread (API level 9) |
2.3 – 2.3.2 |
Gingerbread |
API level 9, NDK 5 |
Android 2.3.3–2.3.7 Gingerbread (API level 10) |
2.3.3 – 2.3.7 |
Gingerbread |
API level 10 |
Android 3.0 Honeycomb (API level 11) |
3.0 |
Honeycomb |
API level 11 |
Android 3.1 Honeycomb (API level 12) |
3.1 |
Honeycomb |
API level 12, NDK 6 |
Android 3.2 Honeycomb (API level 13) |
3.2.x |
Honeycomb |
API level 13 |
Android 4.0–4.0.2 Ice Cream Sandwich (API level 14) |
4.0.1 – 4.0.2 |
Ice Cream Sandwich |
API level 14, NDK 7 |
Android 4.0.3–4.0.4 Ice Cream Sandwich (API level 15) |
4.0.3 – 4.0.4 |
Ice Cream Sandwich |
API level 15, NDK 8 |
Android 4.1 Jelly Bean (API level 16) |
4.1.x |
Jelly Bean |
API level 16 |
Android 4.2 Jelly Bean (API level 17) |
4.2.x |
Jelly Bean |
API level 17 |
Android 4.3 Jelly Bean (API level 18) |
4.3.x |
Jelly Bean |
API level 18 |
Android 4.4 KitKat (API level 19) |
4.4 |
KitKat |
API level 19 |
对于各个名称对应的图片,单独整理出来,供参考:
举例说明:
Android开发期间,配置文件中的target或minimal的API level,如果是17,则对应的是4.2.x的Jelly Bean。
Android获取手机和系统版本等信息的代码
有时候需要统计手机的型号和版本号,利用程序可以获取到相应的手机信息,对比两部手机发现,厂商不同,某个信息显示方式也不尽相同,具体见:
1 String phoneInfo = "Product: " + android.os.Build.PRODUCT; 2 phoneInfo += ", CPU_ABI: " + android.os.Build.CPU_ABI; 3 phoneInfo += ", TAGS: " + android.os.Build.TAGS; 4 phoneInfo += ", VERSION_CODES.BASE: " + android.os.Build.VERSION_CODES.BASE; 5 phoneInfo += ", MODEL: " + android.os.Build.MODEL; 6 phoneInfo += ", SDK: " + android.os.Build.VERSION.SDK; 7 phoneInfo += ", VERSION.RELEASE: " + android.os.Build.VERSION.RELEASE; 8 phoneInfo += ", DEVICE: " + android.os.Build.DEVICE; 9 phoneInfo += ", DISPLAY: " + android.os.Build.DISPLAY; 10 phoneInfo += ", BRAND: " + android.os.Build.BRAND; 11 phoneInfo += ", BOARD: " + android.os.Build.BOARD; 12 phoneInfo += ", FINGERPRINT: " + android.os.Build.FINGERPRINT; 13 phoneInfo += ", ID: " + android.os.Build.ID; 14 phoneInfo += ", MANUFACTURER: " + android.os.Build.MANUFACTURER; 15 phoneInfo += ", USER: " + android.os.Build.USER; 16 // Toast.makeText(this, phoneInfo, Toast.LENGTH_LONG).show(); 17 TextView t = (TextView) findViewById(R.id.main_phoneinfo); 18 t.setText(phoneInfo);
参考文章:http://www.cnblogs.com/hope250/archive/2011/04/04/2005409.html