adbコマンドを使ってターミナルからAndroid端末を操作してみた。
インテント直で投げる
adb shell am start -n パッケージ名/アクティビティクラス
adb shell am start -n com.example.bookmanager_android/.MainActivity
上記を叩くと端末を触らなくてもbookmanagerアプリのMainActivityが開く。
Security exception: Permission Denial
が出た場合
AndroidManifestファイルの開きたいアクティビティ部分にandroid:exported="true"
を追加する。
端末にまかせる
adb shell am start -a アクション -d URL
adb shell am start -a android.intent.action.VIEW -d http://www.google.com/
上記を叩くと端末を触らなくてもgoogleサイトが開く。
おまけ
アプリ側でクエリをもってるとき
adb shell am start -a android.intent.action.VIEW -d testapp.v1://test?open=item\&id=2
testapp.v1://test?open=item&id=2 ⇔ https://www.test.com/jp/item/2 が開く
参考サイト
https://qiita.com/tkc_tsuchiya/items/1fd9953bc1337150dff1
ありがとうございました!