1

I attached the image to complete understanding of my question.

Image of Build Number of my android device

enter image description here

I have pointed out the build number of my android device.

Here is my 2 question.

1) Is it unique for every device or it can be same?

2) if it is unique how we can get it programmatically?

Charuක
  • 12,953
  • 5
  • 50
  • 88
Shafqat Kamal
  • 439
  • 4
  • 12
  • 2
    A build is a software version for a specific device - hence a build number is of course not unique. All devices with the same software version will have the same build id. – Robert Feb 07 '17 at 13:38
  • 1
    It is not unique, it can't be used to ID the device, there is a device id for that, it is not unique but it is randomly (or not ?) generated during the OS installation and can only be changed by reseting the device. You have a small chance to encounter two deviceID similar – AxelH Feb 07 '17 at 13:46
  • 1
    Build Number is related the software version your device have, it's not related to the device itself, so it's not unique – Mohammad Ersan Feb 07 '17 at 13:46
  • See [Is there a unique Android device ID?](http://stackoverflow.com/questions/2785485/is-there-a-unique-android-device-id) for an alternative – AxelH Feb 07 '17 at 13:47
  • if you need unique id for device, I think Mac address will be useful – misha Feb 07 '17 at 14:03
  • Thank you so much for clearing my concept – Shafqat Kamal Feb 08 '17 at 06:10
  • No @misha its not my question – Shafqat Kamal Apr 06 '17 at 08:20

1 Answers1

2

In order to uniquely identify a device you can use the Secure class in which is part of the Android's Settings package. which returns the Android ID as n unique 64-bit hex string. This way:

import android.provider.Settings.Secure;

private String android_id = Secure.getString(getContext().getContentResolver(),
                                                        Secure.ANDROID_ID); 

However, this is non to be null sometimes. An all perfect complete solution to uniquely identify a device is yet to come up. There are various factors to be considered while acquiring the unique id of a device. Also see this Answer

Community
  • 1
  • 1
OBX
  • 6,044
  • 7
  • 33
  • 77