I just updated my application to API 26 and I'm trying to retrieve the serial of the device and I'm seeing that Build.SERIAL
is deprecated on API 26.
What should I use instead?
Use Build.getSerial()
as per the docs. Note that this requires the READ_PHONE_STATE
permission.
Build.SERIAL
This field was deprecated in API level 26. Use getSerial() instead.
Note
[...] For apps targeting SDK higher than Build.VERSION_CODES.O_MR1 this field is set to UNKNOWN.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With