Py4A Python for Android


Android ships with a debugging tool called the Dalvik Debug Monitor Server (DDMS), which provides incoming call and SMS spoofing, location data spoofing, file explorer and more. This introduction is to get you started on the DDMS; for more information please visit the DDMS webpage.

DDMS works with both the emulator and a connected device. If both are connected and running simultaneously, DDMS defaults to the emulator. To start DDMS, from the command line: Type ddms from the tools/ directory

Working with an emulator or device's file system

DDMS provides a File Explorer tab that allows 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. The Py4A scripts are stored in the /sdcard/sl4a/scripts folder

To work with an emulator or device's file system:

  • In the Devices tab, select the emulator that you want to view the file system for.
  • To copy a file from the device, locate the file in the File Explorer and click the Pull file button.
  • To copy a file to the device, click the Push file button on the File Explorer tab.

Setting the location of the phone

If your application depends on the location of the phone, you can have DDMS send your device or AVD a mock location. This is useful if you want to test different aspects of your application's location specific features without physically moving. One method is to set the location by manually specifying decimal longitude and latitude values. To obtain the longitude and latitude values from a map or address, please use our map utility.

Python (Py4A) examples:

Download example scripts