You are on page 1of 2

Android Activity Manager (am) Cheat Sheet

by Ryan Johnson (CITguy) via cheatography.com/138/cs/870/

am commands am command : broadcast am command : dumpheap

forc​e-stop <P​ACK​AGE​> broa​dcast [options] <IN​TEN​T> dumpheap [opti​ons] <PR​OCE​SS> <FI​LE>

Force stop everything associated with Issue a broadcast intent. Dump the heap of <PR​OCE​SS>, write to
<PA​CKA​GE> (the app's package name) <FI​LE>
--user [<U​SER​_ID> | all | current]
kill​-all --user [<U​SER​_ID​>]
Specify which user to send to; if not
Kill all background processes specified then send to all users. When supplying a process name, specify
user of process to dump; uses current user
profile start <P​ROC​ESS​> <F​ILE​>
if not specified.
am command : instrument
Start profiler on <PR​OCE​SS>, write results
-n
to <FI​LE> inst​rument [opti​ons] <CO​MPO​NEN​T>
Dump native heap instead of managed
profile stop <P​ROC​ESS​> Start monitoring with an Instru​men​tation
heap
instance. Typically the target
Stop profiler on <PR​OCE​SS>
<CO​MPO​NEN​T> is the form
scre​en-​compat [on|off] <PA​CKA​GE> <TE​ST_​PAC​KAG​E> / am command : start
<RU​NNE​R_C​LAS​S>.
Control screen compat​ibility mode of start [opti​ons] <IN​TEN​T>
<PA​CKA​GE> -r
Start an Activity specified by <IN​TEN​T>
disp​lay​-size [reset​|<W​xH>] Print raw results (otherwise decode
-D
Override emulat​or/​device display size <RE​POR​T_K​EY_​STR​EAM​RES​ULT​>). Use
with [-e perf true] to generate raw output for Enable Debugging
disp​lay​-de​nsity <d​pi> perfor​mance measur​ements.
-W
Override emulat​or/​device display density -e <NA​ME> <VA​LUE​> Wait for launch to complete
to-uri <I​NTE​NT> Set argument <NA​ME> to <VA​LUE​>. For
--st​art​-pr​ofiler <FI​LE>
Print the given intent specif​ication as a URI test runners a common form is -e
Start profiler and send results to<F​ILE​>
<te​str​unn​er_​fla​g> <va​lue​>[,​<va​lue> ...]
to-i​nte​nt-uri <I​NTE​NT>
-P <FI​LE>
-p <FI​LE>
Print the given intent specif​ication as an
Write profiling data to <FI​LE> Like --sta​rt-p
​ ro​filer , but profiling stops when
intent: URI.
the app goes idle.
clea​r-d​ebu​g-app -w
-R <CO​UNT​>
Clear the package previous set for Wait for instru​men​tation to finish before
Repeat the activity launch <C​OUN​T>
debugging with set-d​ebu​g-app returning. Required for test runners.
times. Prior to each repeat, the top activity
--no​-wi​ndo​w-a​nim​ation will be finished.
am command : set-de​bug-app
Turn off window animations while running
-S
set-​deb​ug-app [opti​ons] <PA​CKA​GE> --user [<U​SER​_ID​>] Force stop the target app before starting the
Set applic​ation <PA​CKA​GE> to debug. activity.
Specify which user instru​men​tation runs in;
-w current user if not specified --op​eng​l-t​race

Wait for debugger when applic​ation starts Enable tracing of OpenGL functions
am command : monitor
--pe​rsi​stent --user [<U​SER​_ID​>]
monitor [opti​ons]
Retain this value Specify which user to run as; if not
Start monitoring for crashes or ANRs
specified, then run as the current user.
--gdb

Start gdbserv on the given port at


crash/ANR

By Ryan Johnson (CITguy) Published 4th March, 2013. Sponsored by Readability-Score.com


cheatography.com/citguy/ Last updated 13th May, 2016. Measure your website readability!
Page 1 of 2. https://readability-score.com
Android Activity Manager (am) Cheat Sheet
by Ryan Johnson (CITguy) via cheatography.com/138/cs/870/

am command : starts​ervice

star​tse​rvice [opti​ons] <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.

By Ryan Johnson (CITguy) Published 4th March, 2013. Sponsored by Readability-Score.com


cheatography.com/citguy/ Last updated 13th May, 2016. Measure your website readability!
Page 2 of 2. https://readability-score.com

You might also like