Of course, there are several ways to do this.
You can use the unix domain socket and open it both from the Android application and from the command line executable that you will create by abusing ndk, clicking on the version-specific location on the device (/ data / local, / sqlite_stmt_journals, etc. ) and run. Edit: In later versions of Android there cannot be such writable / executable directories. You may have to write the application to your personal directory yourself and set global read and execute permissions for it. Next Edit: adb can also forward unix sockets.
The same thing happens with the Internet socket, only now you have the opportunity to configure the front adb port (provided that the Android application is the end of the "server") to communicate with the process running on your development machine directly with the android application, without data transfer through the adb shell. If declaring access to the Internet is not objectionable (this should be less dangerous than letting your ad-drive application on your PC drive), this is probably a method that will adhere to the closest to the "official" features and have the least dependence on the version for Android . It can also be trivially adapted to communicate over Wi-Fi.
You can use a couple of filons and write and read them using shell commands (for portability, create them in a private application store, but make them read / write)
you can play some games with pty
can assume that use files as mailboxes
you can use the "am" command to send Intents (useful if only to launch an Android application if the bit is inefficient for communication)
source share