adb命令操作app

讓App的圖標不顯示

在AndroidManifest.xml中把MainActivity的:

<intent-filter>
                <action Android:name="android.intent.action.MAIN" />
                <category android:name="android.intent.category.LAUNCHER" />

 </intent-filter>

改爲:

<intent-filter>
                <action android:name="android.intent.action.MAIN" />
                <category android:name = "android.intent.category.DEFAULT" />

</intent-filter>

或者去掉  <category android:name="android.intent.category.LAUNCHER" />這一行


一、adb啓動activity:
adb shell am start -n {包(package)名}/{包名}.{活動(activity)名稱}
如:啓動瀏覽器
adb shell am start -n com.android.browser/com.android.browser.BrowserActivity

二、adb關閉activity:
adb shell am force-stop {包(package)名}
如:關閉瀏覽器
adb shell am force-stop com.android.browser
三、adb啓動service:
adb shell am startservice -n {包(package)名}/{包名}.{服務(service)名稱}
如:啓動自己應用中一個service
adb shell am startservice -n com.android.traffic/com.android.traffic.maniservice

四、adb卸載應用程序:
adb uninstall{包(package)名}
如:卸載瀏覽器
adb uninstall com.android.browser
五、adb發送broadcast:
adb shell am broadcast -a <廣播動作>
如:發送一個網絡變化的廣播
adb shell am broadcast -a android.net.conn.CONNECTIVITY_CHANGE

六、adb端口轉發:
adb shell am broadcast -a NotifyServiceStop
adb forward tcp:12580 tcp:10086
adb shell am broadcast -a NotifyServiceStart




發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章