Android 需要命令行来使用 adb 启动 Web 浏览器
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/3512198/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Need command line to start web browser using adb
提问by Shrikant Tudavekar
How can I start a browser with the adb shell
command and make it open a certain web page?
如何使用该adb shell
命令启动浏览器并使其打开某个网页?
回答by Joakim Lundborg
Running this command will start a web browser in android:
运行此命令将在 android 中启动 Web 浏览器:
adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com
回答by ash_jungroup
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'
回答by auselen
If you want to start Chrome specifically
如果您想专门启动 Chrome
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
还可以通过以下方式让 Chrome 访问 sdcard
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.
如果您使用的是 Chrome Canary 版本,请将 com.android.chrome 与 com.chrome.canary 交换。
回答by Bobbi Bennett
I wanted to start silk on my kindle via adb, without adding a new url. I came up with this:
我想通过 adb 在我的 Kindle 上启动 Silk,而不添加新的 url。我想出了这个:
adb shell am start -n com.amazon.cloud9/.browsing.BrowserActivity
回答by kubano
You can open the default web browser with keyevents too (it's possible to write KEYCODE_EXPLORER instead of 64)
您也可以使用 keyevents 打开默认 Web 浏览器(可以编写 KEYCODE_EXPLORER 而不是 64)
adb shell input keyevent 64
Enter an url submit: (66 -> KEYCODE_ENTER)
输入网址提交:(66 -> KEYCODE_ENTER)
adb shell input text "stackoverflow.com" && adb shell input keyevent 66