Stay organized with collections
Save and categorize content based on your preferences.
DeviceId
class DeviceId
The response returned from DeviceLockManager.getDeviceId
on success. A DeviceId represents a stable identifier (i.e. an identifier that is preserved after a factory reset). At this moment, the only supported identifiers are IMEI, MEID and the Device Serial Number.
Summary
Constants |
static Int |
The device id is an IMEI
|
static Int |
The device id is a MEID
|
static Int |
The device id is a serial number
|
Constants
DEVICE_ID_TYPE_IMEI
static val DEVICE_ID_TYPE_IMEI: Int
The device id is an IMEI
Value: 0
DEVICE_ID_TYPE_MEID
static val DEVICE_ID_TYPE_MEID: Int
The device id is a MEID
Value: 1
DEVICE_ID_TYPE_SERIAL_NUMBER
static val DEVICE_ID_TYPE_SERIAL_NUMBER: Int
The device id is a serial number
Value: 2
Public methods
getId
fun getId(): String
Return |
String |
This value cannot be null . |
getType
fun getType(): Int
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-08-20 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-20 UTC."],[],[],null,["# DeviceId\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nDeviceId\n========\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/devicelock/DeviceId \"View this page in Java\") \n\n```\nclass DeviceId\n```\n\n|---|----------------------------------|\n| [kotlin.Any](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-any/index.html) ||\n| ↳ | [android.devicelock.DeviceId](#) |\n\nThe response returned from [DeviceLockManager.getDeviceId](/reference/kotlin/android/devicelock/DeviceLockManager#getDeviceId(java.util.concurrent.Executor,%20android.os.OutcomeReceiver)) on success. A DeviceId represents a stable identifier (i.e. an identifier that is preserved after a factory reset). At this moment, the only supported identifiers are IMEI, MEID and the Device Serial Number.\n\nSummary\n-------\n\n| Constants ||\n|-----------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------|\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEVICE_ID_TYPE_IMEI](#DEVICE_ID_TYPE_IMEI:kotlin.Int) The device id is an IMEI |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEVICE_ID_TYPE_MEID](#DEVICE_ID_TYPE_MEID:kotlin.Int) The device id is a MEID |\n| static [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [DEVICE_ID_TYPE_SERIAL_NUMBER](#DEVICE_ID_TYPE_SERIAL_NUMBER:kotlin.Int) The device id is a serial number |\n\n| Public methods ||\n|----------------------------------------------------------------------------------|----------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | [getId](#getId())`()` \u003cbr /\u003e |\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | [getType](#getType())`()` \u003cbr /\u003e |\n\nConstants\n---------\n\n### DEVICE_ID_TYPE_IMEI\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val DEVICE_ID_TYPE_IMEI: Int\n```\n\nThe device id is an IMEI \n\n Value: 0\n\n### DEVICE_ID_TYPE_MEID\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val DEVICE_ID_TYPE_MEID: Int\n```\n\nThe device id is a MEID \n\n Value: 1\n\n### DEVICE_ID_TYPE_SERIAL_NUMBER\n\nAdded in [API level Baklava](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nstatic val DEVICE_ID_TYPE_SERIAL_NUMBER: Int\n```\n\nThe device id is a serial number \n\n Value: 2\n\nPublic methods\n--------------\n\n### getId\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getId(): String\n```\n\n| Return ||\n|----------------------------------------------------------------------------------|------------------------------|\n| [String](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-string/index.html) | This value cannot be `null`. |\n\n### getType\n\nAdded in [API level 34](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nfun getType(): Int\n```\n\n| Return ||\n|----------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [Int](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-int/index.html) | Value is [android.devicelock.DeviceId#DEVICE_ID_TYPE_IMEI](#DEVICE_ID_TYPE_IMEI:kotlin.Int), [android.devicelock.DeviceId#DEVICE_ID_TYPE_MEID](#DEVICE_ID_TYPE_MEID:kotlin.Int), or [android.devicelock.DeviceId#DEVICE_ID_TYPE_SERIAL_NUMBER](#DEVICE_ID_TYPE_SERIAL_NUMBER:kotlin.Int) |"]]