简体   繁体   English

将Android App与ADB守护程序集成

[英]Integrate Android App with ADB Daemon

I have a requirement to integrate an android application with the ADB Daemon in order to pass commands to it (my Android application) through the USB interface. 我需要将一个Android应用程序与ADB守护程序集成在一起,以便通过USB接口将命令传递给它(我的Android应用程序)。

Is this possible ? 这可能吗 ?

My intention, is to plug this Android device to a Linux device and allow the Linux device to pass commands to the Android application via USB. 我的意图是将该Android设备插入Linux设备,并允许Linux设备通过USB将命令传递给Android应用程序。

Therefore, since ADB is already implemented, and the ADB drivers for Linux also exist, I was wondering whether it would be easier to leverage this to allow the kind of communication I require. 因此,由于已经实现了ADB,并且还存在用于Linux的ADB驱动程序,所以我想知道利用此功能是否允许我进行所需的通信会更容易。

You can use Activity Manager through adb shell. 您可以通过adb shell使用活动管理器 For example, "adb shell am broadcast " will send broadcast intent to attached device. 例如,“ adb shell am广播”将广播意图发送到连接的设备。 Then your app can handle it with broadcast receiver. 然后,您的应用可以使用广播接收器进行处理。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM