1

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.

Dharman
  • 30,962
  • 25
  • 85
  • 135
wuseman
  • 1,259
  • 12
  • 20
  • 1
    there 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 Answers1

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