ADB shell am Function

Source: Internet
Author: User
ADB shell am Function
ADB shell am can use this command to start activity, services; send broadcast and so on from the CMD Console: C: \ Users \ Administrator> ADB shell AM
Usage: am [subcommand] [Options]

Start an activity: am start [-D] [-W] <intent>
-D: Enable debugging
-W: Wait for launch to complete

Start a service: am startservice <intent>

Send a broadcast intent: AM broadcast <intent>

Start an instrumentation: am instrument [flags] <component>
-R: Print raw results (otherwise decode report_key_streamresult)
-E <Name> <value>: Set argument <Name> to <value>
-P <File>: Write profiling data to <File>
-W: Wait for instrumentation to finish before returning

Start profiling: am profile <process> Start <File>
Stop profiling: am profile <process> stop

Start monitoring: am monitor [-- GDB <port>]
-- GDB: Start gdbserv on the given port at crash/ANR

<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>...]
[-- EZ <extra_key> <extra_boolean_value>...]
[-E | -- EI <extra_key> <extra_int_value>...]
[-N <component>] [-F <flags>]
[-- Grant-read-Uri-Permission] [-- Grant-Write-Uri-Permission]
[-- Debug-log-resolution]
[-- Activity-brought-to-front] [-- activity-clear-top]
[-- Activity-clear-when-task-Reset] [-- activity-exclude-from-recents]
[-- Activity-launched-from-history] [-- activity-multiple-task]
[-- Activity-no-animation] [-- activity-no-history]
[-- Activity-no-user-action] [-- activity-previous-is-top]
[-- Activity-reorder-to-front] [-- activity-reset-task-if-needed]
[-- Activity-single-top]
[-- Cycler-registered-only] [-- Cycler-replace-pending]
[<URI>]

Example: Start an activity:
Format: ADB shell am start-N package name/package name + class name (-N class name,-A action,-d date,-M mime-type,-C category, -E ). Instance 1:

C: \ Users \ Administrator> ADB shell am start-N com. Android. Camera/. Camera
Starting: intent {CMP = com. Android. Camera/. Camera}
Instance 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 )}

The extra key is ABC, and the value is the string "hello"

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.