The question is simple. How do I get my phone number via adb. It's not listed in getprop. I guess it's possible to find it under service or settings but i didn't found it. It's a Huawei device with android 8.0 installed.
Asked
Active
Viewed 3,333 times
1
-
1there is a type of sim cards, which don't provide the phone number to the phone, so there is a chance that you simply can't get it on some sim cards – Vladyslav Matviienko Nov 30 '18 at 13:00
-
Ok, i am able to see the number under contacts if i check on my personal info. – wuseman Nov 30 '18 at 13:03
-
Still trying to find a good way for this wtihout root. Foor root devices all simcard data can be found in: sqlite3 -line /data/user_de/0/com.android.providers.telephony/databases/telephony.db 'select * * from siminfo' or from carrier..The phone number is masked with asterix in dumpsys/logcat, another way i s to use tcpdump for sniff the rmnet interface but this is rly to complicated, looking for something more elegant – wuseman Apr 03 '23 at 02:44
1 Answers
1
This might work in some cases.
adb shell service call iphonesubinfo 13
By running this command I am calling getLine1Number method.
This is the aidl file I am referring to.
To know more about adb service command read this
To know the reason why it will not work in other cases, refer this.

royatirek
- 2,437
- 2
- 20
- 34
-
1
-
Edited it. Actually getLine1Number was the 13th line in the aidl file. – royatirek Nov 30 '18 at 19:18