Need command line to start web browser using adb

2019-01-16 03:22发布

How can I start a browser with the adb shell command and make it open a certain web page?

标签: android adb
5条回答
做个烂人
2楼-- · 2019-01-16 03:44

I wanted to start silk on my kindle via adb, without adding a new url. I came up with this:

adb shell am start -n com.amazon.cloud9/.browsing.BrowserActivity
查看更多
Luminary・发光体
3楼-- · 2019-01-16 03:44

You can open the default web browser with keyevents too (it's possible to write KEYCODE_EXPLORER instead of 64)

adb shell input keyevent 64

Enter an url submit: (66 -> KEYCODE_ENTER)

adb shell input text "stackoverflow.com" && adb shell input keyevent 66
查看更多
我只想做你的唯一
4楼-- · 2019-01-16 03:56

If you want to start Chrome specifically

adb shell am start \
-n com.android.chrome/com.google.android.apps.chrome.Main \
-a android.intent.action.VIEW -d 'file:///sdcard/lazer.html'

Also give Chrome access to sdcard via

adb shell pm grant com.android.chrome android.permission.READ_EXTERNAL_STORAGE

Swap com.android.chrome with com.chrome.canary if you are using Chrome canary version.

查看更多
来,给爷笑一个
5楼-- · 2019-01-16 04:00

If your url's are symbol heavy you should also quote aggressively

adb shell am start -a android.intent.action.VIEW -d 'http://stackoverflow.com/?uid=isme\&debug=true'
查看更多
叛逆
6楼-- · 2019-01-16 04:02

Running this command will start a web browser in android:

./adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com
查看更多
登录 后发表回答