android - ADB 是否有可能与第 3 方 Android AIDL 进行通信?
问题描述
Android 可用于adb shell service call SERVICE
与 .aidl 文件通信、传递参数和获取返回值。但是,它属于Android源代码。安装自己编写的非系统应用程序后我可以做同样的事情吗?
例如,我写了一个应用程序,它的包名是com.test.aidl
,里面有一个函数。
fun add(x: Int, y: Int): Int {
return x +y
}
我可以使用 adb 命令,例如在命令提示符下adb shell service call com.test.aidl add i32 1 i32 2
获取值吗?3
解决方案
我已经使用仪器解决了这个问题。
亚行指令
adb shell am insrument -e <NAME> <VALUE> <package/runner>
安卓
public class Test extends android.test.InstrumentationTestRunner{
@Override
public void onCreate(Bundle bundle) {
super.onCreate(arguments);
value = (String) bundle.get("name");
}
然后使用sendStatus api在 CMD 上打印。
推荐阅读
- android - 来自外部文件的 setOnClickListener 用于全屏活动
- r - 直接从环境中解压缩 R 对象
- javascript - 如何在语音通道中播放特定的音频文件?
- git - Git 版本控制的 jmeter 指南
- javascript - 如何检查使用 axios 进行的哪些 api 调用仍在等待中?
- sql-server - 我想在 SQL SERVER 存储过程中加入 4 个表
- javascript - 是否在抛出错误时清除节点 js 中的事件循环?
- matlab - 在 Matlab 中使用带通函数时出错
- powershell - PowerShell - 如何在特定文件上执行 BAT(批处理)命令?(连接路径和命令并传播参数)
- c# - 从网站内容创建 Json 文件并下载它