Transferred from: http://www.52rd.com/Blog/Detail_RD.Blog_blogercn_71675.html
Android in developer mode, we are able to use ADB to execute almost any command on the system/bin/directory on the Andorid phone. Some of these commands are the same as Linux's original commands, some of which are unique to Android, and some are added by MTK. But they are very powerful, without exception. Skilled use of these commands, can effectively reduce the workload of the program debugging.
The AM instruction can send broadcasts, activate activity, start services, and close them in a specific window. Therefore, for UI debugging and module cross-debugging is very useful, one for some do not set launcher action activity, there is no way to start through the menu, you can use the AM command, and two for some need parameters to run activity, The direct run may be faulty or unable to invoke its function, which requires am to start. Third, in some launcher and screen lock windows, there is no way to call other programs directly, but other programs will be launched in these windows under certain conditions, in order to test their interactive operation, need AM instruction. Four for some of the services that run under certain broadcasts, activities, broadcast receivers, debugging is very difficult, using am can be easily solved.
5 for some Windows call the wrong program, you can also use the AM instruction to verify that the error is sent or received
1.am Start an activity
ADB shell am start com.example.scr/. Mainactivity
2.am activate an activity with parameters
ADB shell am start-n com.magcomm.touch/. Touchletteractivity--es letter "E"
--es pass strings, and Ei,el,ez parameters.
-N Use package name plus class name, and a action, C category, etc.
3.am send a broadcast using the action
ADB shell am broadcast-a Magcomm.action.TOUCH_LETTER
4.am sends a broadcast with parameters, using the action
ADB shell am broadcast-a magcomm.action.TOUCH_LETTER--es letter "E"
5.am start a service, without parameters when using the package name with the class name to start, parameters when the N,a,c
ADB shell am startservice com.android.music/. Mediaplaybackservice
6. Close an activity or service, or use the package name
ADB shell am force-stop com.magcomm.touch
PM instructions are also useful
1. Can list the APK installed on the phone and the corresponding package, because the use of the command to remove the APK, you need to know the package name, with this command plus grep or find the package name of the required software can be found
ADB shell PM List packages-f
2 Find the corresponding package installation directory path, a combination of two instructions, you can know to copy to other people's software located on the phone where
ADB shell PM Path COM.EXAMPLE.SCR
2. You can list the permissions that are used
ADB shell PM List permission-groups
ADB shell PM List permissions
Reprint please specify the source:
User_index.rd
Reference:
Http://bbs.ydss.cn/thread-96113-1-1.html
Some of the UI debug commands commonly used by Android AM,PM