How to get the device serial number?

Asked

Viewed 218 times

2

I am using the following code to get the device serial number:

String serial = Build.class.getField("SERIAL").get(null);

But the result is not the same when I check the serial number on the device.

1 answer

4

  • This method does not appear to me in the class Build.

  • Keeps returning me a different value when accessing the cell phone: Settings - > About the device -> Status -> Serial number

  • Which one you’re wearing Build.SERIAL or Build.getSerial();?

  • Build.SERIAL which gives the same result as Build.class.getField("SERIAL").get(null) of my initial question

  • These are the forms the documentation indicates to obtain the serial number. If they do not work it is because, perhaps, the manufacturer does not implement them correctly. If so there is nothing to do, at least that I know.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.