DDMS:Android provides a debugging tool called the Dalvik Debug Monitor Server (DDMS). The Dalvik Debug Monitor Server (DDMS) is a command-line tool.This tool provides you with direct access to the device—whether it’s the emulator virtual device or the physical device.You use DDMS to view and manage processes and threads running on the device, view heap data, attach to processes to debug, and a variety of other tasks.
Advantages of DDMS:
i) DDMS provides port-forwarding services.
ii) Screen capture on the device.
iii) Thread and heap information on the device.
vi) Radio state information.
vii) Incoming call and SMS spoofing, location data spoofing, and more.
How DDMS works : To use DDMS open the perspective DDMS : go to Window->Open Perspective->Other, DDMS
Now take a look into the elements of DDMS:
- Devices: Here we can get the list of devices and emulator which are on line .Below each instance of the Emulator or device, we have all processes that are running in this instance.
I) Bug: This shows you the debugger state. If it is green that means we are connected to the debugger and if it is red we are disconnected from the debugger.
II) Multiple–rows icon: It is an “Update thread” button if we will click on this we will get the information about running thread in the “Thread” tab.
III) Stop icon: To stop the selected process.
IV) Screen Capture icon: By clicking on this we will get a picture of our device/emulator screen.
Threads: We can view the thread information for the selected process. To check thread information, go to Devices tab; select the process that you want to examine the threads for. Click the Update Threads button. And you will get thread information in Thread tab.
Heap: this will allows you to view how much heap memory a process is using. This information is useful in tracking heap usage at a certain point of time during the execution of your application.
Go to Devices tab; Click on the update heap -> Click on the Cause GC
Allocation Tracker: This allows you to track, in real time, where objects are being allocated when you perform certain actions in your application. This information is valuable for assessing memory usage that can affect application performance.
Go to Devices tab; select the process -> click the Start Tracking button-> it will begin allocation tracking ->click on the get allocation
To stop tracking -> click the Stop tracking button
File Explorer: This will allow you to view, copy, and delete files on the device. This feature is useful in examining files that are created by your application or if you want to transfer files to and from the device.
In the Devices tab, select the emulator that you want to view the file system for.
Click the Pull file button: To copy a file from the device, locate the file in the File Explorer.
Click the Push file button: To copy a file to the device.