adb shell am start [options] intent
啟動(dòng)由 intent 指定的 Activity。格式與參數(shù)如下
start [options] intent 啟動(dòng)由 intent 指定的 Activity。
請(qǐng)參閱 intent 參數(shù)的規(guī)范。
具體選項(xiàng)包括:
-D:?jiǎn)⒂谜{(diào)試功能。
-W:等待啟動(dòng)完成。
--start-profiler file:?jiǎn)?dòng)性能剖析器并將結(jié)果發(fā)送至 file。
-P file:類似于 --start-profiler,但當(dāng)應(yīng)用進(jìn)入空閑狀態(tài)時(shí)剖析停止。
-R count:重復(fù)啟動(dòng) Activity count 次。在每次重復(fù)前,將完成頂層 Activity。
-S:在啟動(dòng) Activity 前,強(qiáng)行停止目標(biāo)應(yīng)用。
--opengl-trace:?jiǎn)⒂?OpenGL 函數(shù)的跟蹤。
--user user_id | current:指定要作為哪個(gè)用戶運(yùn)行;如果未指定,則作為當(dāng)前用戶運(yùn)行。
intent 參數(shù)的規(guī)范
對(duì)于采用 intent 參數(shù)的 Activity 管理器命令,您可以使用以下選項(xiàng)指定 intent:
-a action
指定 intent 操作,如 android.intent.action.VIEW。只能聲明一次。
-d data_uri
指定 intent 數(shù)據(jù) URI,如 content://contacts/people/1。只能聲明一次。
-t mime_type
指定 intent MIME 類型,如 image/png。只能聲明一次。
-c category
指定 intent 類別,如 android.intent.category.APP_CONTACTS。
-n component
指定帶有軟件包名稱前綴的組件名稱以創(chuàng)建顯式 intent,如 com.example.app/.ExampleActivity。
-f flags
向 setFlags() 支持的 intent 添加標(biāo)記。
--esn extra_key
添加一個(gè)空 extra。URI intent 不支持此選項(xiàng)。
-e | --es extra_key extra_string_value
以鍵值對(duì)的形式添加字符串?dāng)?shù)據(jù)。
--ez extra_key extra_boolean_value
以鍵值對(duì)的形式添加布爾值數(shù)據(jù)。
--ei extra_key extra_int_value
以鍵值對(duì)的形式添加整數(shù)型數(shù)據(jù)。
--el extra_key extra_long_value
以鍵值對(duì)的形式添加長(zhǎng)整型數(shù)據(jù)。
--ef extra_key extra_float_value
以鍵值對(duì)的形式添加浮點(diǎn)型數(shù)據(jù)。
--eu extra_key extra_uri_value
以鍵值對(duì)的形式添加 URI 數(shù)據(jù)。
--ecn extra_key extra_component_name_value
添加組件名稱,該名稱作為 ComponentName 對(duì)象進(jìn)行轉(zhuǎn)換和傳遞。
--eia extra_key extra_int_value[,extra_int_value...]
添加整數(shù)數(shù)組。
--ela extra_key extra_long_value[,extra_long_value...]
添加長(zhǎng)整數(shù)數(shù)組。
--efa extra_key extra_float_value[,extra_float_value...]
添加浮點(diǎn)數(shù)數(shù)組。
--grant-read-uri-permission
添加 FLAG_GRANT_READ_URI_PERMISSION 標(biāo)記。
--grant-write-uri-permission
添加 FLAG_GRANT_WRITE_URI_PERMISSION 標(biāo)記。
--debug-log-resolution
添加 FLAG_DEBUG_LOG_RESOLUTION 標(biāo)記。
--exclude-stopped-packages
添加 FLAG_EXCLUDE_STOPPED_PACKAGES 標(biāo)記。
--include-stopped-packages
添加 FLAG_INCLUDE_STOPPED_PACKAGES 標(biāo)記。
--activity-brought-to-front
添加 FLAG_ACTIVITY_BROUGHT_TO_FRONT 標(biāo)記。
--activity-clear-top
添加 FLAG_ACTIVITY_CLEAR_TOP 標(biāo)記。
--activity-clear-when-task-reset
添加 FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET 標(biāo)記。
--activity-exclude-from-recents
添加 FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS 標(biāo)記。
--activity-launched-from-history
添加 FLAG_ACTIVITY_LAUNCHED_FROM_HISTORY 標(biāo)記。
--activity-multiple-task
添加 FLAG_ACTIVITY_MULTIPLE_TASK 標(biāo)記。
--activity-no-animation
添加 FLAG_ACTIVITY_NO_ANIMATION 標(biāo)記。
--activity-no-history
添加 FLAG_ACTIVITY_NO_HISTORY 標(biāo)記。
--activity-no-user-action
添加 FLAG_ACTIVITY_NO_USER_ACTION 標(biāo)記。
--activity-previous-is-top
添加 FLAG_ACTIVITY_PREVIOUS_IS_TOP 標(biāo)記。
--activity-reorder-to-front
添加 FLAG_ACTIVITY_REORDER_TO_FRONT 標(biāo)記。
--activity-reset-task-if-needed
添加 FLAG_ACTIVITY_RESET_TASK_IF_NEEDED 標(biāo)記。
--activity-single-top
添加 FLAG_ACTIVITY_SINGLE_TOP 標(biāo)記。
--activity-clear-task
添加 FLAG_ACTIVITY_CLEAR_TASK 標(biāo)記。
--activity-task-on-home
添加 FLAG_ACTIVITY_TASK_ON_HOME 標(biāo)記。
--receiver-registered-only
添加 FLAG_RECEIVER_REGISTERED_ONLY 標(biāo)記。
--receiver-replace-pending
添加 FLAG_RECEIVER_REPLACE_PENDING 標(biāo)記。
--selector
需要使用 -d 和 -t 選項(xiàng)設(shè)置 intent 數(shù)據(jù)和類型。