How to close all chrome browser tab using adb shell command? - android

I was trying to close all chrome browser tabs for an android device using ADB shell command using the following command which is not working.
am start -n com.android.chrome/org.chromium.chrome.browser.ChromeTabbedActivity --action "org.chromium.chrome.browser.clear_tabs
any idea what could be the correct action ?

Related

Any way to get what port is my app using?

I've search a lot and I can't get which port is my app using.
I tried using adb shell netstat -n but I'm not sure if this command is showing me anything related to my app.

Android ADB Open URL in current tab/close previous tabs

I am currently using the following to open a tab in the native browser on an android device
adb shell am start -a "android.intent.action.VIEW" -d "http://google.co.uk"
The issue I have is that each time the command is sent it open a new tabs. To combat this I have tried to kill the browser in an attempt to start again howevre, the previous tab are remembered.
adb shell am force-stop com.android.browser
I did previously try a kill, but this did not seem to work
adb shell am kill com.android.browser
I did some quick reading and found the option create_new_tab but I believe this to be for chrome and not the native browser.
adb shell am start -a "android.intent.action.VIEW" -d "http://google.co.uk" --ez create_new_tab false
Does anyone know how a single tab can be used and either open a tab if one does not exist, or use the existing one if it does. I am using windows command line.
I was able to reuse the same browser tab with the following command:
adb shell am start -a "android.intent.action.VIEW" -d "http://www.google.com" --es "com.android.browser.application_id" "com.package.name"
Some documentation can be found here:
https://developer.android.com/reference/android/provider/Browser.html#EXTRA_APPLICATION_ID

How to open chrome in incognito tab

I have a scenario open a web link in incognito tab in chrome browser. I am using adb command to open chrome and navigate to specific URL i.e adb shell am start -n com.android.chrome/com.google.android.apps.chrome.Main -d weburl .
Is there any way to open link directly in incognito mode through adb?
Try this! it will work.
adb shell am start -n com.android.chrome/org.chromium.chrome.browser.incognito.IncognitoTabLauncher
I could not find any way using adb commands. But using ChromeOptions it is possible if we add "--incognito" argument.
You can launch chrome in incognito mode with the -incognito flag. I am not sure if this will work through ADB, however.

How can I launch the App Info screen for my app through ADB?

I want to launch the App Info screen for my app through adb. I tried to fire an intent using "adb shell am start" but nothing seems to work. I need something that works at least for API levels 18 and 19. Can anyone help?
Open App Info
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS package:com.your.packagename
For Example: if you want to open Chrome App Info
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS package:com.android.chrome
adb shell am start -n yourpackagename/.activityname

Launch any application on emulator via terminal

How do I launch any application via a terminal or command shell on android emulator engine? For example, if I want to start any game, how do I do via a terminal or command shell?
Anyone could help is really appreciated.
Thanks,
Sam.
You can use the am start command trough adb.
Example for the browser app floating around the internet:
am start -a android.intent.action.MAIN -n com.android.browser/.BrowserActivity

Categories

Resources