Is there a way to get the phone number of a phone over adb?
I looked at dumpsys as a likely answer, but none of the system services seem to keep track of the phone's own number.
iphonesubinfo
サービスは、電話番号を含む加入者情報を「追跡」します。残念ながらiphonesubinfo
、サービスはメソッドを実装していないdump()
ため、dumpsys は何も表示しません。または代わりにコマンドを使用service call
して呼び出す必要がありますIPhoneSubInfo.getLine1Number()
IPhoneSubInfo.getMsisdn()
Android のバージョンとキャリアに応じて、次のコマンドの 1 つまたは 2 つを実行すると、電話番号が表示されます (service call
コマンドにはroot
権限が必要です)。
service call iphonesubinfo 4
service call iphonesubinfo 5
service call iphonesubinfo 6
service call iphonesubinfo 7
service call iphonesubinfo 8
特定のデバイスの適切なコードを見つけたい場合は、ADB シェル投稿から Android サービスを呼び出す からスクリプトをダウンロードし、次のように実行します。
./get_android_service_call_numbers.sh iphonesubinfo | grep getLine1Number
アップデート
Android 5.0 のトランザクション コード:
service call iphonesubinfo 11 # getLine1Number()
service call iphonesubinfo 15 # getMsisdn()
Android 5.1 のトランザクション コード:
service call iphonesubinfo 13 # getLine1Number()
service call iphonesubinfo 17 # getMsisdn()