Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to execute simple adb commands not abd shell ones? #65

Closed
Chicagorange opened this issue Aug 3, 2023 · 3 comments
Closed

How to execute simple adb commands not abd shell ones? #65

Chicagorange opened this issue Aug 3, 2023 · 3 comments
Labels
help wanted Extra attention is needed

Comments

@Chicagorange
Copy link

What can we do for you?

Hello,

Is there a way to send simple adb commands?

I would like to retrieve a folder from my device but I can't find a way to do it.

Thank you.

@Chicagorange Chicagorange added the help wanted Extra attention is needed label Aug 3, 2023
@wherewhere
Copy link
Member

This project is direct communicate with adb service. If you want to communicate with adb client, just use Process to send command.

@Chicagorange
Copy link
Author

Thanks for your quick reply.

Actually I don't know the difference between adb shell and adb but I have been able to send my command using Process.
That was my previous solution to send adb and adb shell commands. I just thought that I could send all commands using AdvancedSharpAdbClient.

@wherewhere
Copy link
Member

wherewhere commented Aug 10, 2023

adb.exe is adb client. It communicates with adb service to process commands. This project is a csharp version of adb client to connect with adb server directly.
Some command is not available in adb server, such as adb install-multiple, which is approved by adb client. If you want to send not-shell command, you can use:

var adbSocketFactory = Factories.AdbSocketFactory;
var EndPoint = new IPEndPoint(IPAddress.Loopback, AdbClient.AdbServerPort);
using IAdbSocket socket = adbSocketFactory(EndPoint); 
await socket.SendAdbRequestAsync("your command", cancellationToken); 
AdbResponse response = await socket.ReadAdbResponseAsync(cancellationToken); 
string result = await socket.ReadStringAsync(cancellationToken);

I haven't found the list of adb service command. I only known that if you want to send shell ls, the command is shell:ls. And if you want to send version, it is host: version. You can find this commands by search this repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants