该篇只作为am学习资料备用
am命令使用文档:
usage: am [subcommand] [options]

usage: am start [-D] [-W] [-P ] [–start-profiler ]

           [--sampling INTERVAL] [-R COUNT] [-S] [--opengl-trace]           [--user <USER_ID> | current] <INTENT>   am startservice [--user <USER_ID> | current] <INTENT>   am stopservice [--user <USER_ID> | current] <INTENT>   am force-stop [--user <USER_ID> | all | current] <PACKAGE>   am kill [--user <USER_ID> | all | current] <PACKAGE>   am kill-all   am broadcast [--user <USER_ID> | all | current] <INTENT>   am instrument [-r] [-e <NAME> <VALUE>] [-p <FILE>] [-w]           [--user <USER_ID> | current]           [--no-window-animation] [--abi <ABI>] <COMPONENT>   am profile start [--user <USER_ID> current] <PROCESS> <FILE>   am profile stop [--user <USER_ID> current] [<PROCESS>]   am dumpheap [--user <USER_ID> current] [-n] <PROCESS> <FILE>   am set-debug-app [-w] [--persistent] <PACKAGE>   am clear-debug-app   am monitor [--gdb <port>]   am hang [--allow-restart]   am restart   am idle-maintenance   am screen-compat [on|off] <PACKAGE>   am to-uri [INTENT]   am to-intent-uri [INTENT]   am to-app-uri [INTENT]   am switch-user <USER_ID>   am start-user <USER_ID>   am stop-user <USER_ID>   am stack start <DISPLAY_ID> <INTENT>   am stack movetask <TASK_ID> <STACK_ID> [true|false]   am stack resize <STACK_ID> <LEFT,TOP,RIGHT,BOTTOM>   am stack list   am stack info <STACK_ID>   am lock-task <TASK_ID>   am lock-task stop   am get-config

在命令行里启动一个Activity,方法如下:
am start: start an Activity. Options are:

-D: enable debugging-W: wait for launch to complete--start-profiler <FILE>: start profiler and send results to <FILE>--sampling INTERVAL: use sample profiling with INTERVAL microseconds    between samples (use with --start-profiler)-P <FILE>: like above, but profiling stops when app goes idle-R: repeat the activity launch <COUNT> times.  Prior to each repeat,    the top activity will be finished.-S: force stop the target app before starting the activity--opengl-trace: enable tracing of OpenGL functions--user <USER_ID> | current: Specify which user to run as; if not    specified then run as the current user.

am startservice: start a Service. Options are:

--user <USER_ID> | current: Specify which user to run as; if not    specified then run as the current user.

am stopservice: stop a Service. Options are:

--user <USER_ID> | current: Specify which user to run as; if not    specified then run as the current user.

am force-stop: force stop everything associated with .

--user <USER_ID> | all | current: Specify user to force stop;    all users if not specified.

am kill: Kill all processes associated with . Only kills.

processes that are safe to kill – that is, will not impact the user

experience.

--user <USER_ID> | all | current: Specify user whose processes to kill;    all users if not specified.

am kill-all: Kill all background processes.

am broadcast: send a broadcast Intent. Options are:

--user <USER_ID> | all | current: Specify which user to send to; if not    specified then send to all users.--receiver-permission <PERMISSION>: Require receiver to hold permission.

am instrument: start an Instrumentation. Typically this target

is the form /. Options are:

-r: print raw results (otherwise decode REPORT_KEY_STREAMRESULT).  Use with    [-e perf true] to generate raw output for performance measurements.-e <NAME> <VALUE>: set argument <NAME> to <VALUE>.  For test runners a    common form is [-e <testrunner_flag> <value>[,<value>...]].-p <FILE>: write profiling data to <FILE>-w: wait for instrumentation to finish before returning.  Required for    test runners.--user <USER_ID> | current: Specify user instrumentation runs in;    current user if not specified.--no-window-animation: turn off window animations while running.--abi <ABI>: Launch the instrumented process with the selected ABI.    This assumes that the process supports the selected ABI.

am profile: start and stop profiler on a process. The given argument

may be either a process name or pid. Options are:

--user <USER_ID> | current: When supplying a process name,    specify user of process to profile; uses current user if not specified.

am dumpheap: dump the heap of a process. The given argument may

be either a process name or pid. Options are:

-n: dump native heap instead of managed heap--user <USER_ID> | current: When supplying a process name,    specify user of process to dump; uses current user if not specified.

am set-debug-app: set application to debug. Options are:

-w: wait for debugger when application starts--persistent: retain this value

am clear-debug-app: clear the previously set-debug-app.

am bug-report: request bug report generation; will launch UI

when done to select where it should be delivered.

am monitor: start monitoring for crashes or ANRs.

--gdb: start gdbserv on the given port at crash/ANR

am hang: hang the system.

--allow-restart: allow watchdog to perform normal system restart

am restart: restart the user-space system.

am idle-maintenance: perform idle maintenance now.

am screen-compat: control screen compatibility mode of .

am to-uri: print the given Intent specification as a URI.

am to-intent-uri: print the given Intent specification as an intent: URI.

am to-app-uri: print the given Intent specification as an android-app: URI.

am switch-user: switch to put USER_ID in the foreground, starting

execution of that user if it is currently stopped.

am start-user: start USER_ID in background if it is currently stopped,

use switch-user if you want to start the user in foreground.

am stop-user: stop execution of USER_ID, not allowing it to run any

code until a later explicit start or switch to it.

am stack start: start a new activity on using .

am stack movetask: move from its current stack to the top (true) or bottom (false) of .

am stack resize: change size and position to

更多相关文章

  1. Android的AutoCompleteTextView在API17高版本添加的setText函数
  2. Android(安卓)常用命令
  3. Android(安卓)remake
  4. Android 启动app的几种方式
  5. 从android模拟器中提取文件系统
  6. 【CMake】CMake 引入 ( Android(安卓)NDK 构建脚本 | CMake 命令
  7. Android(安卓)USB状态监控(解决scheme="file")
  8. Android(安卓)wifi-framework WifiMonitor和WifiNative学习
  9. android解析xml文件的方式(其一)

随机推荐

  1. android 生成二维码
  2. android如何使用menu键
  3. Android(安卓)TextView限定行数最大值,点
  4. android的ndk修改app_platform的方法,亲测
  5. Android.API.Context.getFilesDir()
  6. Android库项目的导出及其引用资源
  7. android 屏幕方向控制
  8. Android(安卓)studio安装Genymotion插件
  9. Android(安卓)7.1使用以太网口共享本机4G
  10. android设置字符串到剪贴板