LoginSignup
17
13

More than 5 years have passed since last update.

AndroidアプリのURLスキームのテストをadbから実行する

Posted at

AndroidでURLスキーム(sample:// のようなやつ)をテストしたい時、わざわざテキストに書いて端末に保存しておくのは面倒ですよね。

adbから直接Intentを投げることでテストすることが可能です。

簡単に言うと

  1. adb shellで端末に入って
  2. コンソールからIntentを投げる

です。

前準備

テストしたい端末(or エミュレータ)にshellで入ります。

$ adb shell

adbからIntentを投げる

下記コマンドのように投げます。

am start -a android.intent.action.VIEW -d "sample://"

sample://には任意のURLを入れてください。
これらをどこかテキストとして置いておいて、必要に応じてコピペする等したら便利かもしれませんね。

以上です。

17
13
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
17
13