Android中am命令用法详解

Android中am命令用法

位于frameworks/base/cmds/pm

am命令作用:管理Activity
usage:am [start|broadcast|instrument|profile]
am start -D INTENT

am broadcast INTENT

am instrument [-r] [-e <ARG_NAME> <ARG_VALUE>] [-p <PROF_FILE>]

[-w] <COMPONENT>

am profile <PROCESS> [start <PROF_FILE>|stop]

INTENT is described with:

[-a <ACTION>] [-d <DATA_URI>] [-t <MIME_TYPE>]

[-c <CATEGORY> [-c <CATEGORY>] ...]

[-e|--es <EXTRA_KEY> <EXTRA_STRING_VALUE> ...]

[--ez <EXTRA_KEY> <EXTRA_BOOLEAN_VALUE> ...]

[-e|--ei <EXTRA_KEY> <EXTRA_INT_VALUE> ...]

[-n <COMPONENT>]
[-f <FLAGS>][<URI>]
Thestartcommand starts activity. Use-Doption to make 'DebugOption' true.
Thebroadcastcommand sends broadcast.
Theinstrumentcommand starts instrumentation.
Use-roption to make 'rawMode' true.
Use-eoption to add the pair ofARG_NAMEandARG_VALUEinto Bundle.
Use-poption to specify profileFile.
Use-woption to make 'wait' true in order to new an instance of InstrumentationWatcher.
UseCOMPONENTto specify the name of the instrumentation component.
Theprofilecommand turn on/off profiling in a particular process specified byPROCESS.
Usestartoption to turn on andstopto turn off.UsePROF_FILEto specify the file path of profile.
Use-ato set action specified byACTIONto be performed.
Use-dto create a Uri(data) which parses the given encoded URI stringDATA_URI.
Use-tto specify the type specified byMIME_TYPE. Use-cto add a new category specified by
CATEGORY
to the intent.
Use-eor--esto add extended data to the intent.EXTRA_KEYspecifies the name of the extra data and
EXTRA_STRING_VALUEspecifies the string data value.
Use--ezto add extended data to the intent.EXTRA_KEYspecifies the name of the extra data and
EXTRA_BOOLEAN_VALUEspecifies the serializable data value.
Use-eor--eito add extended data to the intent.EXTRA_KEYspecifies the name of the extra data and
EXTRA_INT_VALUE
specifies the serializable data value.
Use-nto explicitly set the component specified byCOMPONENTto handle the intent.
Use-fto set special flags controlling how this intent is handled.FLAGSspecifies the desired flags.
UseURIto create an intent from a URI.
 
 
打开一个应用可以adb shell进去命令模式之后,
再运行
am start -n 包名/应用名
包名和应用名可以在Androidmanifest.xml文件查看到
例如打开应用程序可以使用命令:
am start -n com.android.settings/com.android.settings.ApplicationSettings

你可能感兴趣的:(C++,c,android,C#,F#)