javaandroidbuild-numbers

Build Number of Android device is unique or not?


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?


Solution

  • 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