Use Android API functions with ADB

2019-08-07 01:48发布

问题:

Is it possible to use the android api functions from the adb? If its possible, what is the syntax to do so? For example I'd like to call the "DATA_CONNECTED" function from android.telephony and get its return value. Link: http://developer.android.com/reference/android/telephony/TelephonyManager.html#CALL_STATE_OFFHOOK

回答1:

There is no DATA_CONNECTED function in Android TelephonyManager. It is a 0x00000002 constant - one of possible response codes to the getDataState() function.

The way you call getDataState() from adb shell is:

service call phone 32

Update: if your phone runs anything older than jb-mr2, the command should be:

service call phone 31

P.S. just finished my write-up on Calling Android services from ADB shell - it includes a small bash script to look up calling codes for any service/method for a specific device.



标签: android api adb