Android AM命令列啟動程式的方法

2021-09-06 04:55:24 字數 2731 閱讀 2339

在android中,除了從介面上啟動程式之外,還可以從命令列啟動程式,使用的是命令列工具am.

啟動的方法為

wangwei@wwg41d3:~$ adb shell

$ su

# am start -n {包(package)名}/{包名}.

程式的入口類可以從每個應用的androidmanifest.xml的檔案中得到,以計算器(calculator)為例,它的

package="com.android.calculator2" …>…

由此計算器(calculator)的啟動方法為:

# am start -n com.android.calculator2/com.android.calculator2.calculator

對於helloactivity這個示例工程,androidmanifest.xml如下所示:

package="com.example.android.helloactivity" …>

由此它的啟動方法為:

# am start -n com.example.android.helloactivity/com.example.android.helloactivity.helloactivity

其他的一些應用啟動命令,如下所示:

calendar(日曆)的啟動方法為:

# am start -n com.android.calendar/com.android.calendar.launchactivity

alarmclock(鬧鐘)的啟動方法為:

# am start -n com.android.alarmclock/com.android.alarmclock.alarmclock

# am start -n com.android.music/com.android.music.musicbrowseractivity

# am start -n com.android.music/com.android.music.videobrowseractivity

# am start -n com.android.music/com.android.music.mediaplaybackactivity

camera(照相機)的啟動方法為:

# am start -n com.android.camera/com.android.camera.camera

browser(瀏覽器)的啟動方法為:

# am start -n com.android.browser/com.android.browser.browseractivity

usage: am [subcommand] [options]

start an activity: am start [-d]

-d: enable debugging

send a broadcast intent: am broadcast

start an instrumentation: am instrument [flags]

-r: print raw results (otherwise decode report_key_streamresult)

-e : set argument to

-p : write profiling data to

-w: wait for instrumentation to finish before returning

start profiling: am profile start

stop profiling: am profile stop

specifications include these flags:

[-a ] [-d ] [-t ]

[-c [-c ] ...]

[-e|--es ...]

[--ez ...]

[-e|--ei ...]

[-n ] [-f ]

啟動的方法為

# am start -n 包(package)名/包名.活動(activity)名稱

啟動的方法可以從每個應用的androidmanifest.xml的檔案中得到

# am start -n com.android.music/com.android.music.musicbrowseractivity

# am start -n com.android.music/com.android.music.videobrowseractivity

# am start -n com.android.music/com.android.music.mediaplaybackactivity

camera(照相機)的啟動方法為:

# am start -n com.android.camera/com.android.camera.camera

browser(瀏覽器)的啟動方法為:

# am start -n com.android.browser/com.android.browser.browseractivity

啟動瀏覽器 :

am start -a android.intent.action.view -d  

撥打** :

am start -a android.intent.action.call -d tel:10086

啟動 google map 直接定位到北京 :

am start -a android.intent.action.view geo:0,0?q=beijing

url:

Android AM命令列啟動程式的方法

在android中,除了從介面上啟動程式之外,還可以從命令列啟動程式,使用的是命令列工具am.usage am subcommand options start an activity am start d d enable debugging send a broadcast intent am ...

Android AM命令列安裝和啟動程式的方法

pm install apk pm uninstall apk adb install r s r 表示重新安裝該apk包 s 表示將apk安裝到sd卡上 在android中,除了從介面上啟動程式之外,還可以從命令列啟動程式,使用的是命令列工具am.啟動的方法為 wangwei wwg41d3 ad...

django 命令列 Helloworld程式

這裡說一下如何使用命令列的方式來構建乙個helloworld專案。當然,python和django一定要先安裝。這個在另一篇中有提到,就不細細說了。一切安裝完畢之後,就可以新建工程了,選擇乙個資料夾作為專案根目錄,這個可以任意選擇。使用cmd cd到這個目錄下面,輸入如下命令 python djan...