Need command line to start web browser using adb

AndroidAdb

Android Problem Overview


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

Android Solutions


Solution 1 - Android

Running this command will start a web browser in android:

adb shell am start -a android.intent.action.VIEW -d http://www.stackoverflow.com

Solution 2 - Android

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'

Solution 3 - Android

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.

Solution 4 - Android

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

Solution 5 - Android

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

Solution 6 - Android

I add --user 0 after start and work in jackpal emulator like this:

adb shell am start --user 0 -a android.intent.action.VIEW -d http://www.stackoverflow.com

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionShrikant TudavekarView Question on Stackoverflow
Solution 1 - AndroidJoakim LundborgView Answer on Stackoverflow
Solution 2 - Androidash_jungroupView Answer on Stackoverflow
Solution 3 - AndroidauselenView Answer on Stackoverflow
Solution 4 - AndroidBobbi BennettView Answer on Stackoverflow
Solution 5 - AndroidkubanoView Answer on Stackoverflow
Solution 6 - Androidfabiano barros de souzaView Answer on Stackoverflow