以下のコマンドを実行するには、USBデバッグとフィンガープリントの許可をあらかじめ済ませておく必要がある。
接続中のデバイスを確認する
$ adb devices
アプリのパッケージ名一覧を取得
$ adb shell pm list package
アプリのパッケージ詳細情報を取得
$ adb shell pm dump <パッケージ名>
TCPモードで起動
USBを使わずTCP/IPでアクセスすることが出来る。
設定できるポートは5555〜5585までだと言われている。
$ adb tcpip 5555
切断する場合
$ adb disconnect
シェルを使う
$ adb shell
コマンドの一覧は adb shell help で表示する。
因みにDCIMやDownloadフォルダがあるディレクトリは /mnt/sdcard
アプリインストール
$ adb install <apkファイルの絶対パス>
アプリ実行
$ adb shell am start -n <パッケージ名>/<クラス名>
クラス名の取得は上で書いたパッケージ詳細情報の初めの部分の内容に記述されている。
DUMP OF SERVICE package:
Activity Resolver Table:
Schemes:
http:
898a736 com.nianticlabs.pokemongo/com.nianticproject.holoholo.libholoholo.unity.UnityMainActivity filter 12fb293
Action: "android.intent.action.VIEW"
Category: "android.intent.category.DEFAULT"
Category: "android.intent.category.BROWSABLE"
Scheme: "http"
Scheme: "https"
Authority: "pokemongolive.com": -1
Path: "PatternMatcher{PREFIX: /launchapp}"
AutoVerify=true
例としてPokémon GOのクラス名をとってみた。
クラス名は com.nianticproject.holoholo.libholoholo.unity.UnityMainActivity
再起動
$ adb reboot