Вы можете получить информацию об устройстве следующим образом.
Log.d(TAG, "RELEASE : " + Build.VERSION.RELEASE);
Log.d(TAG, "SDK : " + Build.VERSION.SDK_INT);
и может получить историю кода версии Android из ОС.
for (Field field : Build.VERSION_CODES.class.getDeclaredFields()) {
field.setAccessible(true);
Log.d(TAG, field.get(this) + " -> " + field.getName());
}
Это вывод.
RELEASE : 5.1.1
SDK : 22
1 -> BASE
2 -> BASE_1_1
3 -> CUPCAKE
10000 -> CUR_DEVELOPMENT
4 -> DONUT
5 -> ECLAIR
6 -> ECLAIR_0_1
7 -> ECLAIR_MR1
8 -> FROYO
9 -> GINGERBREAD
10 -> GINGERBREAD_MR1
11 -> HONEYCOMB
12 -> HONEYCOMB_MR1
13 -> HONEYCOMB_MR2
14 -> ICE_CREAM_SANDWICH
15 -> ICE_CREAM_SANDWICH_MR1
16 -> JELLY_BEAN
17 -> JELLY_BEAN_MR1
18 -> JELLY_BEAN_MR2
19 -> KITKAT
20 -> KITKAT_WATCH
21 -> L
21 -> LOLLIPOP
22 -> LOLLIPOP_MR1
Итак, объедините их и официальный список версий .
API VERSION_CODE VERSION CODE_NAME
1 BASE 1 (no code name)
2 BASE_1_1 1.1 (no code name)
3 CUPCAKE 1.5 Cupcake
4 DONUT 1.6 Donut
5 ECLAIR 2 Eclair
6 ECLAIR_0_1 2.0.1 Eclair
7 ECLAIR_MR1 2.1 Eclair
8 FROYO 2.2.x Froyo
9 GINGERBREAD 2.3 - 2.3.2 Gingerbread
10 GINGERBREAD_MR1 2.3.3 - 2.3.7 Gingerbread
11 HONEYCOMB 3 Honeycomb
12 HONEYCOMB_MR1 3.1 Honeycomb
13 HONEYCOMB_MR2 3.2.x Honeycomb
14 ICE_CREAM_SANDWICH 4.0.1 - 4.0.2 Ice Cream Sandwich
15 ICE_CREAM_SANDWICH_MR1 4.0.3 - 4.0.4 Ice Cream Sandwich
16 JELLY_BEAN 4.1.x Jelly Bean
17 JELLY_BEAN_MR1 4.2.x Jelly Bean
18 JELLY_BEAN_MR2 4.3.x Jelly Bean
19 KITKAT 4.4 - 4.4.4 KitKat
20 KITKAT_WATCH 4.4W KitKat Watch
21 LOLLIPOP 5 Lollipop
22 LOLLIPOP_MR1 5.1 Lollipop
23 M 6 Marshmallow
24 N 7 Nougat
25 N_MR1 7.1 Nougat
Это говорит, что код версии API25 - N_MR1.