How do I launch "com.android.settings.Settings$VpnSettingsActivity" via adb - android

I tried to use
adb shell am start com.android.settings/.Settings$VpnSettingsActivity
to launch vpn activity. But it just launched com.android.settings.Settings.
Could any method launch the activity via adb?
Thanks.

you need to escape or single-quote the $ character:
adb shell "am start -n 'com.android.settings/.Settings$VpnSettingsActivity'"

Related

adb "am start -n" not working for debug version

I am trying to use adb to launch activites for testing,But it does not work for the debug version :
This works
adb shell am start -n com.xx.xx/.main.ParentActivity
This doesn't
adb shell am start -n com.xx.xx.debug/.main.ParentActivity
Both debug and release packages are available under /data/data
If you have class com.xx.xx.main.ParentActivity and your application id is com.xx.xx.debug then you have to specify FQCN like this:
adb shell am start -n com.xx.xx.debug/com.xx.xx.main.ParentActivity
Dot just after slash is shortcut which can be used only if FQCN starts with application id.
use adb shell am start -D -n com.xx.xx.debug/.main.ParentActivity -a android.intent.action.MAIN -c android.intent.category.LAUNCHER
then you will be able to attach your debugger (via your IDE) and the app will start (see https://blog.jetbrains.com/idea/2011/05/new-in-105-attach-debugger-to-a-running-android-process/)

Supress output from android activity running from adb shell

Android activity is launched from adb shell by the command am start -n packagename/.activityname
When the activity is started it is displaying the status stating the android activity ... in the adb shell
How to supress that output into adb shell
Use linux- redirect the output to /dev/null.
am start -n packagename/.activityname > /dev/null

adb command to turn on FM

I looked up and down but did not come across anything.
Is there any ADB command or android way to to turn on FM in an android phone? Or i will have to create and app to do this?
You might be able to use Activity Manager commands from adb
adb shell am start -a <some intent>
or
adb shell am startservice -a <some intent>
but you should read the question Android Intent to launch radio application
Unless you can find out what the intent is called then you may be completely stuck.

Android: launch app info dialog via adb shell am

I'm trying to write a script which will launch the "app info" system dialog via adb for an app I'm testing.
I have done some investigation and came up with this command, which will launch "app info" but fails with a force close (NullPointerException in logcat):
adb shell am start -a android.intent.action.VIEW -n com.android.settings/.applications.InstalledAppDetails -es com.android.settings.ApplicationPkgName com.my.app -es pkg com.my.app
Seems that the package name isn't being properly passed.
What is the correct way to pass the package name parameter to the am command in this case?
adb shell am start -a android.settings.APPLICATION_DETAILS_SETTINGS -d package:<package-name>
Also, check this: https://stackoverflow.com/a/4567928/4409113
adb shell am start -n com.package.name/com.package.name.ActivityName
http://developer.android.com/tools/help/shell.html#am
You can also issue an activity manager command directly from adb
without entering a remote shell.
For example:
adb shell am start -a android.intent.action.VIEW
Seems like, start -a is a good way.

How can I run Android camera application from adb shell?

How can I run android camera program from adb shell?
I know that I should use am but I do not know what command should I exactly enter
I used this:
am start -a android.intent.action.MAIN -n com.android.camera
But it didn't work!
Alternatively, you can start the camera in 2 other ways
Image capture mode: adb shell "am start -a android.media.action.IMAGE_CAPTURE"
Video capture mode: adb shell "am start -a android.media.action.VIDEO_CAPTURE"
Other information
To focus: adb shell "input keyevent KEYCODE_FOCUS"
To take a photo or start/stop recording: adb shell "input keyevent KEYCODE_CAMERA"
Other notes
f the keycode string e.g KEYCODE_CAMERA, does not work, lookup the constant value from the API description. Example: KEYCODE_CAMERA
KEYCODE_CAMERA: Added in API level 1
Constant Value: 27 (0x0000001b)
I'd like to add to Keo Malope's answer that while IMAGE_CAPTURE and VIDEO_CAPTURE are likely to work on most devices, I have encountered cases where they don't work as expected. In this case, we have two more constants that we can try:
STILL_IMAGE_CAMERA
adb shell am start -a android.media.action.STILL_IMAGE_CAMERA
VIDEO_CAMERA
adb shell am start -a android.media.action.VIDEO_CAMERA
Create a CameraActivity class.
Implement camera functionality there and add to AndroidManifest.xml file.
Then use following command:
am start -a android.intent.action.MAIN -n [package-name].CameraActivity
I hope this will solve your problem.
You need to specify exact component name (name of activity).
am start -a android.intent.action.MAIN -n com.android.camera/.CameraEntry
It is working on my device (HTC Desire HD), but I can't guarantee that it'll work everywhere.
it works for me here
adb shell am start -n com.mediatek.camera/com.android.camera.CameraActivity

Categories

Resources