MonkeyDevice. Docand Developer tools
विज्ञापन
विज्ञापन
MonkeyDevice
75. MonkeyDevice
Content from developer.android.com/tools/help/MonkeyDevice.html through their Creative Commons Attribution 2.5 license
A monkeyrunner class that represents a device or emulator accessible by the workstation running
monkeyrunner.
This class is used to control an Android device or emulator. The methods send UI events, retrieve information, install and remove applications, and run applications.
You normally do not have to create an instance of MonkeyDevice . Instead, you use
MonkeyRunner.waitForConnection() to create a new object from a connection to a device or emulator. For example, instead of using: newdevice = MonkeyDevice() you would use: newdevice = MonkeyRunner.waitForConnection()
Summary
Constants
string DOWN
string UP
Use this with the type argument of press() or touch() to send a DOWN event.
Use this with the type argument of press() or touch() to send an UP event.
string DOWN_AND_UP Use this with the type argument of press() or touch() to send a DOWN event immediately followed by an UP event.
Methods void void broadcastIntent (string uri, string action, string data, string mimetype,
iterable categories dictionary extras, component component, iterable flags)
Broadcasts an Intent to this device, as if the Intent were coming from an application. drag (tuple start, tuple end, float duration, integer steps)
Simulates a drag gesture (touch, hold, and move) on this device's screen.
object getProperty (string key)
Given the name of a system environment variable, returns its value for this
385
Content from developer.android.com/tools/help/MonkeyDevice.html through their Creative Commons Attribution 2.5 license
object void
dictionary instrument (string className, dictionary args)
Runs the specified component under Android instrumentation, and returns the results in a dictionary whose exact format is dictated by the component being run. The component must already be present on this device. void installPackage (string path)
Installs the Android application or test package contained in packageFile onto this device. If the application or test package is already installed, it is replaced. press (string name, dictionary type)
Sends the key event specified by type to the key specified by keycode. void
MonkeyDevice device. The available variable names are listed in the detailed description of this method. getSystemProperty (string key)
. The API equivalent of adb shell getprop <key>. This is provided for use by platform developers.
void
object void reboot (string into)
Reboots this device into the bootloader specified by bootloadType. removePackage (string package)
Deletes the specified package from this device, including its data and cache. shell (string cmd)
Executes an adb shell command and returns the result, if any. startActivity (string uri, string action, string data, string mimetype, iterable categories dictionary extras, component component, flags)
Starts an Activity on this device by sending an Intent constructed from the supplied arguments.
386
Content from developer.android.com/tools/help/MonkeyDevice.html through their Creative Commons Attribution 2.5 license
डाउनलोड
विज्ञापन