Detect Android N version code

后端 未结 4 1862
既然无缘
既然无缘 2021-02-06 03:12

Is it possible to detect if an user is running Android N?

I have a Nexus 6 with the Android N Developer Preview. If I try to get the build version with Build.VERSI

4条回答
  •  眼角桃花
    2021-02-06 03:30

    Approach 1: (recommended) Use support library android.support.v4.os.BuildCompat.isAtLeastN.

    Approach 2: Use this as the "real" version code: Build.VERSION.SDK_INT < 23 || Build.VERSION.PREVIEW_SDK_INT == 0 ? Build.VERSION.SDK_INT : Build.VERSION.SDK_INT + 1.

提交回复
热议问题