After reading this post Android: How to programmatically access the device serial number shown in the AVD manager (API Version 8) I managed to get my device's serial number but my question is that when I run the code on my samsung s8 device I don't get the same number as writen in device's settings (RF8K129**** and programmatically I get ce11171bc599*****) and when I run my code on another xiaomi device numbers match. The code for getting serial number is
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
sn = Build.getSerial();
} else{
sn=Build.SERIAL;
}
What should I do to get the device serial number that can be found in device's settings menu?