如何通过ADB命令获取高API级别设备及三星Galaxy设备的IMEI
Hey there, I see you're struggling to pull the IMEI from your Samsung Galaxy via ADB—let's get this sorted out.
Why Your Current Commands Aren't Working
- The
adb shell dumpsys iphonesubinfocommand is restricted on most modern Samsung devices (and newer Android versions) due to tightened permission controls. Regular ADB shell users don’t have access to this service anymore, which is why you’re getting no output. - When you ran
adb shell service call iphonesubinfowithout specifying the method number, you triggered a generic call that returns raw Parcel data. That messy hex output actually contains your IMEI—it just needs a little parsing.
Method 1: Parse the Raw Parcel Output
The Parcel data you received uses UTF-16 encoding for the IMEI string. Here’s how to extract it:
- Skip the initial hex values (the first 8 bytes in your example:
00000000 0000000f) and focus on the rest. In your output, that’s00350033 00390038 00320037 00380030 00350034 00350031 00300031. - Each pair of bytes starting with
00maps to an ASCII character. For example:0033→ '3'0035→ '5'0038→ '8'
- Extract these characters in order, and you’ll get your full IMEI. For your sample output, that would be 35897208451510 (double-check against your device’s actual IMEI to confirm the order).
To make this easier, run the specific service call command targeting the IMEI retrieval method directly:
adb shell service call iphonesubinfo 1
(Note: On some Android 10+ devices, use 2 instead of 1 if the above doesn’t work.)
This returns a Parcel focused solely on the IMEI, making parsing faster.
Method 2: Use Alternative Commands (No Parsing Needed)
If hex parsing feels like a hassle, try these simpler commands that work on most Samsung devices:
- Telephony Registry Dump:
This will return a line likeadb shell dumpsys telephony.registry | grep mDeviceIdmDeviceId=35897208451510—just grab the value after the equals sign. - System Property Check:
Many Samsung devices store the IMEI in this system property, which you can pull directly.adb shell getprop ril.deviceid
Note About Root Access
If none of the above work, your device might have stricter security controls. If your device is rooted, try running the commands with root privileges:
adb root adb shell dumpsys iphonesubinfo
Root access grants full access to restricted services, so this should return the IMEI directly if other methods fail.
内容的提问来源于stack exchange,提问作者yash




