Androidアプリで取得できるシステム情報 (Build.xxx) の値をまとめてみた

Androidアプリで取得できるシステム情報 (Build.xxx) の値をまとめてみた

Androidアプリで「Build.xxx」や「Build.VERSION.xxx」の各キーで取得できる値をまとめてみました。
Clock Icon2020.06.11

この記事は公開されてから1年以上経過しています。情報が古い可能性がありますので、ご注意ください。

Androidアプリが動いている端末の情報を取得したくなりましたが、「どれを使えば何の値が取得できるの?」とよく分かりませんでした。 そこで実際に試してみました。

環境

  • Android Studio: 3.6.3
  • Pixcel 3a: Android 10

Build.XXXの内容

Name Value
BOARD sargo
BOOTLOADER b4s4-0.2-6066691
BRAND google
DEVICE sargo
DISPLAY QQ2A.200501.001.B2
FINGERPRINT google/sargo/sargo:10/QQ2A.200501.001.B2/6352890:user/release-keys
HARDWARE sargo
HOST abfarm831
ID QQ2A.200501.001.B2
MANUFACTURER Google
MODEL Pixel 3a
PRODUCT sargo
SUPPORTED_32_BIT_ABIS armeabi-v7a, armeabi
SUPPORTED_64_BIT_ABIS arm64-v8a
SUPPORTED_ABIS arm64-v8a, armeabi-v7a, armeabi
TAGS release-keys
TIME 1585700613000
TYPE user
USER android-build

Build.VERSION.XXXの内容

Name Value
BASE_OS (empty)
CODENAME REL
INCREMENTAL 6352890
PREVIEW_SDK_INT 0
RELEASE 10
SDK_INT 29
SECURITY_PATCH 2020-05-05

サンプルコード

上記を調べた際のサンプルコードです。

class MainActivity : AppCompatActivity() {

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)

        Log.d("SAMPLE", "Build.BOARD: ${Build.BOARD}")
        Log.d("SAMPLE", "Build.BOOTLOADER: ${Build.BOOTLOADER}")
        Log.d("SAMPLE", "Build.BRAND: ${Build.BRAND}")
        Log.d("SAMPLE", "Build.DEVICE: ${Build.DEVICE}")
        Log.d("SAMPLE", "Build.DISPLAY: ${Build.DISPLAY}")
        Log.d("SAMPLE", "Build.FINGERPRINT: ${Build.FINGERPRINT}")
        Log.d("SAMPLE", "Build.HARDWARE: ${Build.HARDWARE}")
        Log.d("SAMPLE", "Build.HOST: ${Build.HOST}")
        Log.d("SAMPLE", "Build.ID: ${Build.ID}")
        Log.d("SAMPLE", "Build.MANUFACTURER: ${Build.MANUFACTURER}")
        Log.d("SAMPLE", "Build.MODEL: ${Build.MODEL}")
        Log.d("SAMPLE", "Build.PRODUCT: ${Build.PRODUCT}")
        Log.d("SAMPLE", "Build.SUPPORTED_32_BIT_ABIS: ${Build.SUPPORTED_32_BIT_ABIS}")
        Log.d("SAMPLE", "Build.SUPPORTED_64_BIT_ABIS: ${Build.SUPPORTED_64_BIT_ABIS}")
        Log.d("SAMPLE", "Build.SUPPORTED_ABIS: ${Build.SUPPORTED_ABIS}")
        Log.d("SAMPLE", "Build.TAGS: ${Build.TAGS}")
        Log.d("SAMPLE", "Build.TIME: ${Build.TIME}")
        Log.d("SAMPLE", "Build.TYPE: ${Build.TYPE}")
        Log.d("SAMPLE", "Build.USER: ${Build.USER}")

        Log.d("SAMPLE", "Build.VERSION.BASE_OS: ${Build.VERSION.BASE_OS}")
        Log.d("SAMPLE", "Build.VERSION.CODENAME: ${Build.VERSION.CODENAME}")
        Log.d("SAMPLE", "Build.VERSION.INCREMENTAL: ${Build.VERSION.INCREMENTAL}")
        Log.d("SAMPLE", "Build.VERSION.PREVIEW_SDK_INT: ${Build.VERSION.PREVIEW_SDK_INT}")
        Log.d("SAMPLE", "Build.VERSION.RELEASE: ${Build.VERSION.RELEASE}")
        Log.d("SAMPLE", "Build.VERSION.SDK_INT: ${Build.VERSION.SDK_INT}")
        Log.d("SAMPLE", "Build.VERSION.SECURITY_PATCH: ${Build.VERSION.SECURITY_PATCH}")

        Build.SUPPORTED_32_BIT_ABIS.forEach {
            Log.d("SAMPLE", "SUPPORTED_32_BIT_ABIS: $it")
        }
        Build.SUPPORTED_64_BIT_ABIS.forEach {
            Log.d("SAMPLE", "SUPPORTED_64_BIT_ABIS: $it")
        }
        Build.SUPPORTED_ABIS.forEach {
            Log.d("SAMPLE", "SUPPORTED_ABIS: $it")
        }
    }
}

参考

Share this article

facebook logohatena logotwitter logo

© Classmethod, Inc. All rights reserved.