通过ADB使用Android API函数 [英] Use Android API functions with ADB

查看:593
本文介绍了通过ADB使用Android API函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以使用adb中的android api函数?如果可能,这样做的语法是什么?
例如,我想从android.telephony调用 DATA_CONNECTED函数并获取其返回值。链接: http://developer.android.com/reference/android/telephony /TelephonyManager.html#CALL_STATE_OFFHOOK

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

推荐答案

没有 DATA_CONNECTED 函数。它是一个 0x00000002 常量- getDataState() 函数。

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

adb shell 调用 getDataState()的方式是:

service call phone 32

更新:如果您的电话运行早于jb-mr2的任何文件,命令应为:

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

service call phone 31

PS刚刚在从ADB shell -它包含一个小的bash脚本,用于查找特定设备的任何服务/方法的调用代码。

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.

这篇关于通过ADB使用Android API函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆