How to open a URL from a terminal

I am writing a script to run on an Android server, and I need it to open a browser and a URL. I managed to open the browser, but could not find a way to place the URL on it.

am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity; 

Appreciate any help :)

+6
source share
1 answer

Just use Intent.ACTION_VIEW (i.e. android.intent.action.VIEW ), for example:

 am start -a android.intent.action.VIEW -d http://www.xing.de 

This launches the XING website. If you have more than one browser installed, you can, of course, add the name of the browser component that you want to run, for example:

 am start -a android.intent.action.VIEW -n com.android.browser/.BrowserActivity -d http://www.xing.de 

Hooray!

+10
source

Source: https://habr.com/ru/post/944732/


All Articles