Usage of ADB shell am

Source: Internet
Author: User

ADB shell am Use this command to start activity, services, send broadcast, etc. from the cmd console:
1C:\users\administrator>adb shell am2 usage:am [subcommand] [options]3 4Start an activity:am start [-d] [-W] <INTENT>5-d:enable Debugging6-W:wait  forlaunch to complete7 8Start a service:am startservice <INTENT>9 TenSend a broadcast intent:am broadcast <INTENT> One  AStart an INSTRUMENTATION:AM instrument [flags] <COMPONENT> --R:print Raw Results (otherwise decode Report_key_streamresult) --e <NAME> <value>: set argument <NAME> to <VALUE> the-P <file>:WriteProfiling data to <FILE> --W:wait  forinstrumentation to finish before returning -  -Start Profiling:am profile <PROCESS> start <FILE> +Stop Profiling:am Profile <PROCESS>Stop -  +Start Monitoring:am Monitor [--gdb <port>] A--gdb:start Gdbserv on the given port at crash/ANR at  -<INTENT>specifications include these flags: -[-a <action>] [-D ] [-T <MIME_TYPE>] -[-C <CATEGORY> [-C <CATEGORY>] ...] -[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...] -[--esn <EXTRA_KEY> ...] in[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...] -[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...] to[-n <component>] [-F <FLAGS>] +[--grant-read-uri-permission] [--grant-Write-uri-permission] -[--debug-log-resolution] the[--activity-brought-to-front] [--activity-Clear-Top] *[--activity-Clear-when-task-reset] [--activity-exclude-from-Recents] $[--activity-launched-from-history] [--activity-multiple-Task]Panax Notoginseng[--activity-no-animation] [--activity-no-History ] -[--activity-no-user-action] [--activity-previous-is-Top] the[--activity-reorder-to-front] [--activity-reset-task-if-needed] +[--activity-single-Top] A[--receiver-registered-only] [--receiver-replace-Pending] the[<uri>]

Use instances: such as starting an Activity:
-N Package Name/package name + class name (-N class name,-a action,-d date,-m mime-type,-c category,-e Extended data, etc.).

Example 1:

C:\USERS\ADMINISTRATOR&GT;ADB Shell am start-n com.android.camera/. Camera
starting:intent {cmp=com.android.camera/. Camera}
Example 2: (Intent with extra) c:\users\administrator>adb shell am start-n com.android.camera/. CAMERA-E ABC Hello
starting:intent {cmp=com.android.camera/. Camera (has extras)} where extra's key is ABC, value is the string "Hello" and can also send commands to simulate the mobile low-power environment:

Instance:

ADB shell am broadcast-a android.intent.action.BATTERY_CHANGED--ei "level" 3--ei "scale" 100

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.