yashsingh1/xdaforums huggingface dataset:
[Android Software Development] regaw_leinad:
Ah, I need to improve the UpdateDevices method in my dll, I'm working on that today actually, instead of a call, I'm going to have it on a constant loop with events for device added/removed/state change. I'm hoping to release it today. for the mean time, here is a modification to your code that will work. I tested it.

Device device;
AndroidController android = new AndroidController();

while (!android.HasConnectedDevices) {}

device = android.ConnectedDevices[0];

Console.WriteLine("Connected Device - {0}", device.SerialNumber);

Console.ReadLine();
Adb.ExecuteAdbCommandNoReturn(android, Adb.FormAdbCommand("forward tcp:" + adb_port + " tcp:" + adb_port, ""))

try and use the .HasConnectedDevices boolean for checking if there are any devices plugged in. It's a shortcut I made for the ConnectedDevices.Count checking and cleans up the code look a bit. but here in the example, I just put that check on a loop, it only loops for about 320 milliseconds in the test I made. I'll work on fixing all of that though today.

And also, the Adb class has a method PortForward that does the same thing as you wrote in the last line, just

Adb.PortForward(android, device, adb_port, adb_port);

no need to run Adb.Execute.... on it.
[Android Software Development] bibovodanh:
Thanks! This dll is very useful for saving huge codes in developing. I would use it in my future tools. Keep it up :)
[Android Software Development] regaw_leinad:
I understand there are issues with this new release. I have been having trouble figuring out a new solution to this problem. I will keep thinking about solutions. For now, 1.0.0.1 is the best one to use. It is not multithreaded however, and may freeze your WinForms app for a little bit while it updates the device list.
[Android Software Development] Beatsleigher:
Correct me if I'm wrong, but:

ExecuteFastbootCommand(FormFastbootCommand("enter command here"))(;)

Should work.
[Android Software Development] .torrented:
This ^
[Android Software Development] hoseyni-:
thnx i can use from (device) methods to reboot boot loader or .. but i cant use from fastboot command : general fastboot command and get resulat from fastboot command .. can you upload example program for me to slove my problem ??
[Android Software Development] hoseyni-:
problem

thnx i can use from (device) methods to reboot boot loader or .. but i cant use from fastboot command : general fastboot command and get resulat from fastboot command .. can you upload example program for me to slove my problem ??
[Android Software Development] Beatsleigher:
Why you spam?

View attachment 2719626
[Android Software Development] hoseyni-:
sorry..was wrong
[Android Software Development] .torrented:
You can replace the string with whatever command you want to put it for fastboot
[Android Software Development] AngSanley:
I need precompiled dll
[Android Software Development] Beatsleigher:
Just download the source and compile it yourself... It takes five minutes.
[Android Software Development] regaw_leinad:
This was 15 posts ago (on the same page)
[Android Software Development] AngSanley:
btw, can I check for fastboot devices too? and do some flashing through fastbooot
[Android Software Development] hoseyni-:
i have problem for use adb command in my progrom .!!

for example :

Adb.ExecuteAdbCommand("adb reboot-bootloader");

does not work for me.

plz help me ...
[Android Software Development] Beatsleigher:
and.ExecuteAdbCommand(adb.FormAdbCommand(@"adb reboot-bootloader"));

That should work
[Android Software Development] hoseyni-:
i wrote this command :

AndroidController android;

Device device;

private void button1_Click(object sender, EventArgs e)

{

Adb.ExecuteAdbCommand(Adb.FormAdbCommand(@"adb reboot-bootloader"));

}

It does not work for me ... :(

(there is not any error ..!! but it does not work ....) how can i solve it?
[Android Software Development] Beatsleigher:
Have you tried connecting your device and turning USB debugging on?
[Android Software Development] hoseyni-:
Yes !! i have one connected device !! usb debuging is turn on ... but i cant get right answer ! :eek:
[Android Software Development] Beatsleigher:
And did you properly initialize the AdbController?
[Android Software Development] hoseyni-:
how can i properly initialize the adb controller ?
[Android Software Development] Beatsleigher:
AndroidController adbController;

List<Device> devices;

public void init() {

adbController = AndroidController.Instance;

foreach (String dev in adbController.ConnectedDevice)

devices.Add(adbController.GetConnectedDevice(dev));

}
[Android Software Development] regaw_leinad:
That's because it's incorrect. Do not pass "adb" into the method. It's already added internally.
[Android Software Development] hoseyni-:
i could solve the problem to execute.. but how can i receive the the orders which have output like model of an device or unlock token code etc
[Android Software Development] Beatsleigher:
It's been a while since I used AndroidLib. I was only vaguely remembering. But thanks
[Android Software Development] regaw_leinad:
No worries, just correcting the code :p
[Android Software Development] Beatsleigher:
:p Speaking of which, are there any plans of making it Mono-compatible?
[Android Software Development] regaw_leinad:
Honestly, I'm a bit too busy with my job to dive into that head first. Would take quite a bit of refactoring, and I just don't think I have the time to sit down and plan it out. I have everything in my head, just no time for implementation. The only thing compatability-wise is that the resources are windows-only. What basically needs to be done is much better interfacing/abstraction in terms of communicating with the debug server. I wasn't the greatest programmer when I wrote this, years ago.

Either that, or I just implement the raw TCP protocol, which would take more time, but not have the compatibility issues.
[Android Software Development] Beatsleigher:
Well, what I'm doing with JDroidLib, is determining the OS and then installing the respective files - I'm sure the same could be done here.
[Android Software Development] regaw_leinad:
Well yes, that would be handled in a manager class, and it would pick the correct interface implementation based on the OS. No need to "install" anything really, just use them from a temp directory and dispose on shutdown.
[Android Software Development] Beatsleigher:
Well, yes. That's what JDroidLib does, I just like to call installing, because installing, in a nutshell, is just extracting to a specific directory.

Should you need the binaries, they're in JDroidLib's repo

Edit:

Here's the installer class, if you want to reference anything: https://github.com/Beatsleigher/JDr...idLib/src/JDroidLib/util/ResourceManager.java
[Android Software Development] hoseyni-:
i can get prop in usb debuging mode but cant get prop or device information in fastboot bode ..plz help me for it...
[Android Software Development] Rain_Saeid:
adb Command

Hi to all

how to Use Command :

how to delete file : Storage\System\CSC\Language.xml
[Android Software Development] AngSanley:
hi, i'm coding with vb.net and I need to get some build.prop values, let's say ro.product.model and the output goes to a string

how the code should be written? I need to get the device model ;)

edit: I got it ;) Label3.Text = device.BuildProp.GetProp("ro.product.model")
[Android Software Development] AngSanley:
edit: solved
[Android Software Development] avicohh:
Hi thanks a lot for this project.

There is a way to imlement adb wait-for-device by event or something that will call method when device is connected?

Thanks!
[Android Software Development] regaw_leinad:
My plan was to write an event bus and event handler system for a new version of this, but have just never have found the time. I'll be a bit less busy in a month or so, so hopefully I can start work on that eventually, as well as integrating the unix binaries as well so it will be compatible with the mono framework.
[Android Software Development] avicohh:
Thanks a lot man.

I'm looking forward to it

I saw some tools like lingo root or vroot that implemented this. I don't know exactly how.

I also saw another library called mad-bee, that has those events.

Is a very big library, but with no documentation at all.

So any way, I will wait to your update.

Thank you very much.
[Android Software Development] regaw_leinad:
Yep, mADB(ee) was the reason I wrote this library lol. I completely agree that it is very useful, with a bunch of events you can subscribe to, etc, but I also agree that it is very large and undocumented. That being said, mADB is basically a port of the DDMS tool's backend, which implements the debug bridge's TCP protocol. If I had more time, I would just implement that, but my guess is it's changed a bunch recently, and I don't have the time to do all the research. I plan on embedding the binaries in the assembly for now, and possibly a ways in the future, implementing the IO protocol so it doesn't rely on Google's binaries.
[Android Software Development] avicohh:
Thanks again.

Did you managed to use those events of mad-bee?

I have tried a lot of things to make it work, especially the DeviceConnected event, but with no luck.

If you managed to make it work (in win form or wpf application), I will love to see some example.

Thank's again.
[Android Software Development] regaw_leinad:
Only spent a day or so with it over 2 years ago lol. Haven't looked at it since. I believe it's no longer maintained anymore either, so who knows if the protocol is up to date anymore.
[Android Software Development] avicohh:
I beleve it is.

I managed to do some basic operations, like reboot or push.

I'm using 4.4.4 android version, and old adb versions not working with 4.2.2+ android versions, so the adb must be updated.
[Android Software Development] regaw_leinad:
Just checked, hasn't been touched since May 2013.

About the versions, are you referring to that library, or mine?
[Android Software Development] avicohh:
Both.

For examle, yours in 1.5.1 version did not work on my device, i belive it's because it had an old adb version.

Only 1.5.2 work's fro me.

I guess may 2013 it's enough for the new android versions. (for the new permissions thing on the device itself, when you trying to do adb operations that wasn't exist in the old amdroid versions)
[Android Software Development] Rain_Saeid:
Hi regaw_leinad

My phone Was Rooted

how to delete file By command in AndroidLib : Storage\System\CSC\Language.xml
[Android Software Development] sony_mlog:
Hi, anyone try it with emulator Bluestacks 8.0 (rooted) please help me :(

this is my test code:

if (android.HasConnectedDevices)
{
serial = android.ConnectedDevices[0];
device = android.GetConnectedDevice(serial);

MessageBox.Show(device.BuildProp.GetProp("ro.product.model"));
if (device.BuildProp.SetProp("ro.product.model", "GT-S5630")) { MessageBox.Show("OK"); } else { MessageBox.Show("false"); }

}

getProp return me right answer, but i cant setProp, then i tried to Pull build.prop file to HDD but i don't know the path of this device, pls help me, thanks so so so much :crying: .
[Android Software Development] Beatsleigher:
If you're going to pull the whole build.prop file from the device (which you shouldn't, last time I checked, setprop worked), the code would be:

private void pullProp() {
var adbController = AdbController.Instance;
var connectedDevices = adbController.ConnectedDevices;
var selectedDevice = adbController.GetConnectedDevice(<select a device/serial from the list>);

Adb.ExecuteAdbCommand(selectedDevice, "pull", "/system/build.prop", Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.DesktopDirectory), "YourProgram", "buildprop", selectedDevice.SerialNumber, "build.prop"));
}

or at least something similar. Someone's probably going to correct me, but that should work.
[Android Software Development] sony_mlog:
[MENTION=4320277]Beatsleigher[/MENTION]

thank you, i tried to work with adb command, but i got i problem with permission. i know that is reason why i can't setProp, pls help me about it . thank you.

---------- Post added at 08:31 PM ---------- Previous post was at 08:26 PM ----------

i have to press F5 in 7 hour to reload this topic for waiting an answer :) , thanks again [MENTION=4320277]Beatsleigher[/MENTION]
[Android Software Development] Beatsleigher:
Well, you do know that you have to do the SetProp command via shell, right?

Adb.ExecuteAdbCommand(Adb.FormAdbCommand(selectedDevice, "shell", "setprop", "propYouWantToSet"));
[Android Software Development] sony_mlog:
string re = Adb.ExecuteAdbCommand(Adb.FormAdbCommand(device, "shell", "setprop", "ro.product.model GT-S5630"));
MessageBox.Show(re);

i tried this but it not work, messagebox tell me no thing :(
[Android Software Development] Beatsleigher:
This code wouldn't work with JDroidLib, either; setprop doesn't return anything. It's like entering "cmd.exe" into the command prompt. It'll open a new instance, but won't return anything.

You'll have to re-read the prop and see if the value has changed, or check your device.
[Android Software Development] Ather:
Default parameter specifiers are not permitted

Thgats the error i get when trying to build from src
[Android Software Development] _Noctis_:
Walking the file system?

I'm trying to get the folders / files structure from my phone. I thought it'll be a rather straight operation using device.FileSystem.Something_goes_here();, but I have no idea what / how to do that...

Am I in the right direction, or do I need to find out how to do it with ADB, and then use the adb command to do that?

Having said that, assuming I want to have a similar "OpenFileDialog", any ideas if this was implemented somewhere ? (I'm sure I'm not reinventing the wheel here ... )

Cheers, and thanks in advance.

(funny, I looked at madbee, and as you all say -> big + no comments / tutorials what so ever ... what a shame / waste).
[Android Software Development] Beatsleigher:
This isn't VB or C# code, instead it's Java, but it's all the ADB operations you'd need to do what you want.

But I think I'll add some code to AndroidLib and create a pull request with some other things I've noticed could be different.
[Android Software Development] _Noctis_:
So, specifically we're talking about the <list> method I assume. Code reads just fine even though I haven't touched Java for a while (could be fooled to think it's C# :) .

Not sure if it means I need busybox, but i'll give it a go and see if I can come up with something.

Cheers, and do update if you push to AndroidLib :)
[Android Software Development] Beatsleigher:
Yep, I was mainly pointing out that one, but hey. Feel free to use all of them :)

I've requested a pull, just waiting for [MENTION=2326081]regaw_leinad[/MENTION] to see if he likes and accepts it.

I'll take that as a compliment ;)

EDIT: Asked him if he'd check it out on Twitter. He's probably busy with the Hypixel server at the moment, so it might take some time.
[Android Software Development] _Noctis_:
What is he doing on a minecraft look alike of CS ?!

He better not be playing instead of giving us his time and expertise for free !!!

:)
[Android Software Development] regaw_leinad:
Haha I merged in that method that he sent the request for, modified it a bit for efficiency, and now you can pull the changes and build a new one.
[Android Software Development] _Noctis_:
I'll give it a spin when I'll get home
[Android Software Development] Beatsleigher:
I just requested another pull.

We both missed a brain fart; where the method checks, whether the device has busybox installed: If it doesn't, it won't add the rootDir param to the command, so the list will either contain an error, or be empty.
[Android Software Development] sony_mlog:
[MENTION=2326081]regaw_leinad[/MENTION] Hi, today i haveto endtask my application, and it has gotten a problem with JIT after , can not load Adroidlib again :( . how can i fix it pls. [MENTION=4320277]Beatsleigher[/MENTION]: thanks for last help. can u help me this problem, pls .//PS:

Thanks i solved it. this because application can not buid "RegawMOD\AndroidLib" , i tried to delete it in AppData , and it will buid new.
[Android Software Development] elegos:
Hello!

I've tried executing Adb.ExecuteAdbCommand (or any variant), but I'm facing a problem: it won't wait for the adb process to end. I've tried executing the very same command (adb backup with my params taken from the command in debug mode) and the adb exe waits for the user interaction on the device. This is not happening inside this library. The result indeed is the string asking the user to unlock the device and to accept the backup command, but that's all.

Is there a way to let the library wait for it?

Edit: I've noticed this behavior to not wait for the user's input is the library's adb.exe's one. I'm going to replace the exe with the one I've got installed...

Edit 2: it seems to be the -system option to let the backup fail (tried both on a rooted and a non-rooted device on Lollipop).

Thanks
[Android Software Development] Beatsleigher:
Your program should warn the users and tell them to unlock their devices before carrying on. This is no fault of AndroidLib; it's just laziness.
[Android Software Development] elegos:
Nope, you don't have to unlock your device before doing the backup... AFAIK... it's just the -system option which lets ADB return immediately - maybe you have to ask for root privileges first?
[Android Software Development] Beatsleigher:
No, normally you don't, but it's the way .NET processes processes. (Sounds weird, I know)

If you unlock the device beforehand, the process cannot stop and ask for the user to unlock their device.
[Android Software Development] elegos:
Well, during my tests the only case the adb process exits (both in AndroidLib and in "manual mode") is setting the -system option, with or without the device unlocked. Maybe it's a lollipop bug?
[Android Software Development] Rain_Saeid:
hang on program

hi

tnx for AndroidLib

Hello

My problem is that

When I use the command shell

Execution time

Hong's program

I must stop

for example :

Private Sub Button10_Click(sender As Object, e As EventArgs) Handles Button10.Click

Dim serial As String
android.UpdateDeviceList()
If (android.HasConnectedDevices) Then
serial = android.ConnectedDevices(0)
device = android.GetConnectedDevice(serial)
Adb.ExecuteAdbShellCommandInputString(device, "su", "mount -o rw,remount /system", "rm filename.dat", "exit", "exit")
device.Reboot()
RichTextBox1.Text = "Please Wait..."
Else
RichTextBox1.Text = "Error - No Devices Connected"
End If
End Sub

pls help me

or

How to Shell commands in the batch file؟
[Android Software Development] elegos:
According to the Adb.cs source file (NS RegawMOD.Android.Adb), there is a public static method:

public static AdbCommand FormAdbShellCommand(Device device, bool rootShell, string executable, params object[] args)

There is also a Su class which tests against the existence and version of the super user binary, so I'd test it before doing the root command.
[Android Software Development] Beatsleigher:
You're executing multiple commands at once, or at least you're trying to.

Try this:

If (android.HasConnectedDevices) Then
Dim m_device As Device = android.GetConnectedDevice()
If (m_device.HasRoot) Then
Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(m_device, "su", "mount", "-o", "rw", "remount", "/system"))
Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(m_device, "su", "rm", "file.name") )
' I have no idea why you want to su rm files, but now I know for sure that I'm not going to use one of your programs without source
Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(m_device, "su", "mount", "-o", "ro", "remount", "/system"))
End If
End If
[Android Software Development] Rain_Saeid:
tnx Beatsleigher

but not Work

pls Write an example in vb.net and attach..

tnx
[Android Software Development] Beatsleigher:
I'm not here to do all your work.
[Android Software Development] EncryptedCurse:
I get "An unhandled exception of type 'System.NullReferenceException' occurred in..." with the following code:

Public Class Form2
Dim android As AndroidController

Private Sub Form2_Load(sender As Object, e As EventArgs) Handles MyBase.Load
android.UpdateDeviceList()

Also, "Adb.ExecuteAdbCommand" brings up "Value of type 'String' cannot be converted to 'RegawMOD.Android.AdbCommand'." everytime, no matter what I try to put in the parentheses.

This is the first time I'm attempting to use a library and my knowledge of coding is very rudimentary. Thanks in advance.
[Android Software Development] Beatsleigher:
You didn't give the variable an instance of AndroidController.

Try this:

public class Form2

private m_adbController As AndroidController = Nothing

public sub New()
m_adbController = AndroidController.Instance
end sub

public sub MyBase_Load(sender as object, evt as EventArgs) Handles mybase.Load
android.UpdateDeviceList()
end sub

end class
[Android Software Development] Rain_Saeid:
Hi

My problem was solved :

Good lock
[Android Software Development] EncryptedCurse:
Nevermind, resolved.
[Android Software Development] Rain_Saeid:
problem for China tablet's

Hi

tnx for thread AndroidLib Library

The program works fine AndroidLib

just Only Chinese tablet does not accept

For example, I 'm get Info but The tablet does not identify

Where is the problem ?
[Android Software Development] chakky:
Hi guys,

i searched the documentation:

http://www.regawmod.com/software/windows/androidlib/current/documentation/index.html

this is an empty site :( have anybody an other link? thx
[Android Software Development] Beatsleigher:
The AndroidLib library isn't being developed any further. As far as I'm aware, Regaw isn't doing any software at the moment, due to his position on the Hypixel server (correct me if I'm wrong). At best just check out the code. What are you looking at doing?
[Android Software Development] chakky:
oh thats not good :/

I have a project, which called an app with adb and a shell command.

so i used this function:

so its starts an instance "adb.exe".

I must start this command in a very short timeinterval (one per second), so my system starts thousands of adb.exe instances.

I search a way doesnt start more than 2 oder 3 instances or close this instance thats come with Adb.ExecuteAdbShellCommandInputString Command.

(sry my bad english, i hope u can understand it)
[Android Software Development] Beatsleigher:
You're taking the Mick... Your English is by far better than most peoples' English. Lol

I'd suggest trying this (this is how I solved that problem in JDroidLib, or at least the idea is the same)

private void RunLoop() {
for (int i = 0; i < 100; i++) {// Symbolic loop
// Run ADB command
/*Enter your command here...*/
// Kill ADB server afterwards
Adb.ExecuteAdbCommandNoReturn(Adb.FormAdbCommand("kill-server"));
}
}

I'm not sure if this will work 100%, but it should.
[Android Software Development] chakky:
Thx.

Today i found an other solution for my problem but i will try it your solution too.
[Android Software Development] Mickosis:
Hello, can you tip me on how to create a button that pushes a file (.db) to a specific app's folder? Thanks in advance!

Or at least can you guys provide a working link to the documentation? I just want to push/pull from a specific folder (/data/data/test.com.classmanagertest/databases/ClassRecords.db)

Here is my test code which doesn't work:

If (android.HasConnectedDevices) Then

Dim device As Device = android.GetConnectedDevice()

Adb.ExecuteAdbCommand(Adb.FormAdbShellCommand(device, "su", "mount", "-o", "rw", "remount", "/data"))

Adb.ExecuteAdbCommand(Adb.FormAdbCommand(device, "pull", "/data/data/test.com.classmanagertest/databases/ClassRecords.db", "C:\Mickosis"))

MsgBox("Pulling succesful!")

Else

MsgBox("Error - No Devices Connected")

End If

What's weird if I pull the directory only, it works but I get a copy of the ClassRecords without the extensions

Thanks guys