android am命令

来源:互联网 发布:mysql数据库安装教程 编辑:程序博客网 时间:2024/05/22 06:13

位于frameworks/base/cmds/pm

am命令作用:管理Activityusage:am [start|broadcast|instrument|profile]am start -D INTENTam broadcast INTENTam 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 byCATEGORYto the intent.Use-eor--esto add extended data to the intent.EXTRA_KEYspecifies the name of the extra data andEXTRA_STRING_VALUEspecifies the string data value.Use--ezto add extended data to the intent.EXTRA_KEYspecifies the name of the extra data andEXTRA_BOOLEAN_VALUEspecifies the serializable data value.Use-eor--eito add extended data to the intent.EXTRA_KEYspecifies the name of the extra data andEXTRA_INT_VALUEspecifies 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

原创粉丝点击