Search code examples
androidnexus-7imei

How to get Nexus 7 serial number programmatically?


We've developed an app that needs to identify every device uniquely. We first thought of using IMEI and we're obtaining it using the TelefonyManager's getDeviceId() method.

But one user reported that the app doesn't work and it seems we weren't able to get the IMEI. I read here that some Nexus 7 don't have an IMEI, that they use another way for serial number: CSSN. How can I obtain it? Or, even better, is there a preferable way to uniquely identify every android device?

PS: We do have one Nexus 7 here for testing and it works perfectly, that's why before I said some Nexus 7.


Solution

  • Try the below code to get the device serial number :

    Log.i("TAG","android.os.Build.SERIAL: " + Build.SERIAL);
    

    You may go through the Android Documentation.