Loading...

Getting a Unique ID of Android Device Programmatically

Sometimes it is required to get the unique ID of android device (phone, tablet, tv, wear) while developing the android application. If you are looking to find/get the unique ID of an android device or having trouble in finding your device or android app installed in the device. In this tutorial, you will learn to get a unique ID or serial number of an android device programmatically.

There are many ways to find and get android device unique ID. Here I am going to show the simplest and easiest ways to get a unique ID of an android device and display it in TextView.

Related:
How to Get the IP Address of Android Device Programmatically
How to Get the Phone Number Programmatically in Android
Check Internet Connection in Android

Android Example: How to Get a Unique ID/Serial Number of Android Device


Following is the code of Java activity file and xml layout file.

XML Layout File


res/layout/unique_id_of_android_device.xml

Java Activity File


Following is the little bit java code to get the unique ID of an android device.

src/GettingUniqueIDAndroidDevice.java

Strings.xml File


res/values/strings.xml

Android Example: How to Get a Unique ID of Android Device

That’s all. Now, run your Getting a Unique ID of Android Device Programmatically application, you will see the unique ID of your mobile in the screen.
Tutorial 1812227949603456169
Home item