Android Activity Manager (am) Cheat Sheet

A Software › Android cheat sheet in English by CITguy

Shortcuts for Android Activity Manager (am)

59,530 views 6,756 downloads 4 Mar 2013 History
4.9 avg · 1 rating

am commands

force-stop <PA­CKA­GE>
Force stop everything associated with <PA­CKA­GE> (the app's package name)
kill-all
Kill all background processes
profile start <PR­OCE­SS> <FI­LE>
Start profiler on <PR­OCE­SS>, write results to <FI­LE>
profile stop <PR­OCE­SS>
Stop profiler on <PR­OCE­SS>
screen­-compat [on|off] <PA­CKA­GE>
Control screen compat­ibility mode of <PA­CKA­GE>
displa­y-size [reset­|<W­xH>]
Override emulat­or/­device display size
displa­y-d­ensity <dp­i>
Override emulat­or/­device display density
to-uri <IN­TEN­T>
Print the given intent specif­ication as a URI
to-int­ent-uri <IN­TEN­T>
Print the given intent specif­ication as an intent: URI.
clear-­deb­ug-app
Clear the package previous set for debugging with set-de­bug-app

am command : set-de­bug-app

set-de­bug-app [options] <PA­CKA­GE>
Set applic­ation <PA­CKA­GE> to debug.
-w
Wait for debugger when applic­ation starts
--pers­istent
Retain this value

am command : broadcast

broadcast [options] <IN­TEN­T>
Issue a broadcast intent.
--user [<U­SER­_ID> | all | current]
Specify which user to send to; if not specified then send to all users.

am command : instrument

instrument [options] <CO­MPO­NEN­T>
Start monitoring with an Instru­men­tation instance. Typically the target <CO­MPO­NEN­T> is the form <TE­ST_­PAC­KAG­E> / <RU­NNE­R_C­LAS­S>.
-r
Print raw results (otherwise decode <RE­POR­T_K­EY_­STR­EAM­RES­ULT­>). Use with [-e perf true] to generate raw output for perfor­mance measur­ements.
-e <NA­ME> <VA­LUE>
Set argument <NA­ME> to <VA­LUE­>. For test runners a common form is -e <te­str­unn­er_­fla­g> <va­lue­>[,­<va­lue> ...]
-p <FI­LE>
Write profiling data to <FI­LE>
-w
Wait for instru­men­tation to finish before returning. Required for test runners.
--no-w­ind­ow-­ani­mation
Turn off window animations while running
--user [<U­SER­_ID­>]
Specify which user instru­men­tation runs in; current user if not specified

am command : monitor

monitor [options]
Start monitoring for crashes or ANRs
--gdb
Start gdbserv on the given port at crash/ANR

am command : dumpheap

dumpheap [options] <PR­OCE­SS> <FI­LE>
Dump the heap of <PR­OCE­SS>, write to <FI­LE>
--user [<U­SER­_ID­>]
When supplying a process name, specify user of process to dump; uses current user if not specified.
-n
Dump native heap instead of managed heap

am command : start

start [options] <IN­TEN­T>
Start an Activity specified by <IN­TEN­T>
-D
Enable Debugging
-W
Wait for launch to complete
--star­t-p­rofiler <FI­LE>
Start profiler and send results to <FI­LE>
-P <FI­LE>
Like --star­t-p­rofiler, but profiling stops when the app goes idle.
-R <CO­UNT>
Repeat the activity launch <CO­UNT> times. Prior to each repeat, the top activity will be finished.
-S
Force stop the target app before starting the activity.
--open­gl-­trace
Enable tracing of OpenGL functions
--user [<U­SER­_ID­>]
Specify which user to run as; if not specified, then run as the current user.

am command : starts­ervice

starts­ervice [options] <IN­TEN­T>
Start the Service specified by <IN­TEN­T>
--user [<U­SER_ID]
Specify which user to run as; if not specified, then run as the current user.

am command : kill

kill [options] <PA­CKA­GE>
Kill all processes associated with <PA­CKA­GE> (the app's package name). This command kills only processes that are safe to kill and that will not impact the user experi­ence.
--user [<U­SER­_ID> | all | current]
Specify user whose processes to kill; all users if not specified.

Badges

Useful Cheat Sheet Nice Cheat Sheet Good Cheat Sheet Downloaded from Unusual Locations × 2

Comments (1)

Atta 15:28 5 Mar 2016

How to get the permissions list the application have for a secondary user?

Reply

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.