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
Asked
Active
Viewed 6,672 times
1 Answers
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.

Alex P.
- 30,437
- 17
- 118
- 169
-
Can I use every API function in that manner? Same question as in the other question, how do you know what int to supply the service? – timonsku Oct 30 '13 at 16:50
-
in theory you can call any service IPC method with `adb shell service call`. in practice you won't be able to provide all needed parameters for many methods. but it works great for the basic stuff like most `getState` type of functions. – Alex P. Oct 31 '13 at 07:58
-
Thanks, very usefull to know, accepted that as an answer. Comes as close as it can get I guess. – timonsku Nov 01 '13 at 11:49
-
1after almost a year I finally remembered to publish my post on how to find out calling codes for services for a specific android version – Alex P. Sep 23 '14 at 04:22