yashsingh1/xdaforums huggingface dataset:
[Android Software Development] Infinimint:
I absolutely LOVE this and am rewriting my applications to use it.

However, whenever I use this code in VB.NET:

RegawMOD.Android.Device.RebootRecovery()
RegawMOD.Android.AndroidController.WaitForDevice()

The phone reboots and the whole application freezes and no longer responds even after my device reconnects.

I have a MyTouch 3G and am using Visual Studio 2010.
[Android Software Development] regaw_leinad:
Ok, well the .WaitForDevice will not work correctly right now in a Windows Forms application, because it pauses the current thread until a device is found. This is also stated in the documentation under AndroidController.WaitForDevice() and AndroidController.WaitFOrDeviceAlternate() method subjects. I wrote this mainly for use in Console Applications (not like many people write those anymore in C#/VB). For now, you could write the WaitForDevice on a separate thread with a callback, depending on what you are doing after the callback.

And thanks for letting me know about Reboot, I forgot to change that in my last build. :)

EDIT: Just investigated it more, RebootRecovery does halt the main thread for a few seconds, freezing the main form for that time. I am adding that call to a separate thread in the library. The reason it continues to be frozen is because of WaitForDevice. Try using WaitForDeviceAlternate for now (which should work). I am going to get rid of the first one in the code, and replace it with the alternate under the name WaitForDevice(). The old one you are using won't recognize devices in Recovery. whoops :p
[Android Software Development] Infinimint:
Hahaha that's what I had meant. I know RebootRecovery doesn't do it, it was the WaitForDevice being ran after it :)

I'm going to try out the WaitForDeviceAlternate and see how it goes :D

Thanks for the help. Also, do you have any plans to release the source?

EDIT: Also, when the device is in Bootloader, I noticed that most (if not all) of the reboot commands do not work.
[Android Software Development] regaw_leinad:
I knew that you knew, I just wanted to be sure :p

Yes, I am planning on it after I update a few more features and get all the little internal bugs worked out.

I tested and you're right, it seems to be an issue with the fastboot binary. I'll fix that in the next update.
[Android Software Development] Infinimint:
Sounds great, I'm very anxious to try out the new version and see the magic behind the source :)
[Android Software Development] demoneyes905:
Questions, questions, questions.... :)

A couple of questions:

is this project and library you are giving to us (thank you btw :) ) open source?

If so, is there a repository to which I can see the code and help contribute?

I know .NET and Mono are very similar and most of the API is essentially the same but I have to ask: Have you tested this on Mono?

I ask the last question because if you used function calls used in both Mono and .NET, your DLL can essentially be used for programs created in OS X, Linux as well as Windows. :D

I can't wait to get started using this. Thanks again!

EDIT: I don't know if the questions were already asked and if so, I am sorry. The search thread option doesn't seem to be working for me for some reason.
[Android Software Development] Infinimint:
He said in Post #66 that it is not yet open source, but he is planning on it.

As for Mono, I have no idea :)
[Android Software Development] regaw_leinad:
For update 1.2.0.0 (the next one coming) I have implemented the Singleton method in the AndroidController class. This will change some of your existing code you have written in your own projects, but not by much. In fact, it will get rid of the need to supply your AndroidController instance to the other methods you call. Along with that, there are many bug fixes, a few new classes, a method to verify that the resources AndroidLib uses have not been modified before running your commands, and much more. Again, sorry for the inconvenience of having to rewrite some of your code, but this will prove for a much more stable base to build off of.

EDIT: And I am looking into building this with Mono support as well. Thanks for mentioning it demoneyes905!
[Android Software Development] Infinimint:
Can't wait :D
[Android Software Development] regaw_leinad:
Updated to 1.2.0.0

Links are in the OP. Also updated the sample solutions as well. When changing your code to fit the new update, you should only have to remove arguments from method calls, and not have to ADD any new code.
[Android Software Development] regaw_leinad:
Updated to 1.2.1.0. Check the OP for download/changelog. Also, added my source to github (check the OP under Download Info)!
[Android Software Development] regaw_leinad:
I'm going to continue to update, clean up code, and add more features, but I would like to ask now if there is anything anyone would like integrated into this library now. I have established a great base and would like to expand it. Please leave your suggestions/comments here!
[Android Software Development] _breez_:
nice library ;) it will definetely make the life of .net developers easier
[Android Software Development] filmaker:
This is awesome thanks. But I'm having an issue...why doesn't this command work?

Device device = new Device();
device.Reboot();

it maybe something trivial that I just don't see..I'm still sort of new to c#..thanks though.
[Android Software Development] regaw_leinad:
Ah, no worries, I wrote it for people that were new to .NET could easily understand it. In the Getting Started guide, it should tell you how to get the device, but I'll tell you here anyways.

You need use the AndroidController.Instance to get all of the connected devices. You can save AndroidControler.Instance in a variable named android like this.

AndroidController android = AndroidController.Instance

then using that, you can get a list of all the connected device serial numbers using

List<string> allDevices = android.ConnectedDevices

You then you can select which serial number you want, either in your own code (ConnectedDevices[0] is the first one connected), or display them all and let the user choose.

Then to get an instance of Device, you use

Device device = android.GetConnectedDevice(serialNumber)

where serialNumber is a string that you choose out of allDevices. Then you can call[code[ device.Reboot()[/code]Hope this helps and is clear!
[Android Software Development] filmaker:
Okay that makes sense. Thanks!!
[Android Software Development] regaw_leinad:
Updated to 1.2.2.0

Info in first post

Source on GitHub
[Android Software Development] Chalky94:
Thank you for this!

Very well done!
[Android Software Development] Chalky94:
Is it possible to install .apks with this.dll directly or would I have to push them with the adb command?
[Android Software Development] regaw_leinad:
Funny you should mention that. In the next update I am adding part of my PackageManager system, which will include installing apks directly and simply through a method call in the library, and a few other small updates as well.
[Android Software Development] regaw_leinad:
Updated to 1.2.3.0

See OP for details and source on github
[Android Software Development] regaw_leinad:
I'd like to apologize to anyone trying to download this... GoDaddy appears to be down... The entire GoDaddy site, along with all of my domains and brothers domains... So, hopefully this comes back online soon!

Dan
[Android Software Development] Infinimint:
You should try Media Temple, its amazing ;)
[Android Software Development] g4rb4g3:
Hi regaw_leinad, I started creating an C# program that uses your library and I have to say it's a great thing. It makes life pretty easy.

But I have one little problem. I execute a sqlite querry that can contain "umlaute" (öäü) but the signs I get look totaly weird. I think it has something to do with the encoding that is being used, in the database everything looks ok but when I execute the command (doesn't matter if I use your lib or if I execute it on an adb shell) I get weird characters not the umlaute I expect.

Do you know if there is a way to change the encoding to UTF8 somehow?
[Android Software Development] g4rb4g3:
Since I didn't get an answer I changed my program to pull the database file and use System.Data.SQLite for my SQL-queries.
[Android Software Development] regaw_leinad:
Ah man, sorry I haven't been around much this week, I've had lots of shows during the days and evenings. I had thought about encoding problems before, and I will think up a way to be able to choose your encoding, or just stick with the default. Hope you can then update your program with that in the future.
[Android Software Development] g4rb4g3:
No problem at all, you are providing a great library that makes writing programs alot easier. Thanks for that, and maybe you'll find a solution for the encoding problem sometime.

Gesendet von meinem Galaxy Nexus mit Tapatalk 2
[Android Software Development] regaw_leinad:
Added online documentation to the OP under "Download Latest Release" section. Will have a new build in a few days with more features and bug fixes.
[Android Software Development] g4rb4g3:
Nice, but the link doesn't work (at least for me).

When I click on it it loads something and then I get an error that the server can not be found. That's the link in the address bar:

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

It's missing a ":" after http.
[Android Software Development] regaw_leinad:
Thanks, I messed that one up haha! Fixed.
[Android Software Development] Empty2k12:
This is great. Now i can write prorgams in Visual Basic which comunicate with android phones

Very good:D:D:D:D:D

sent from my icecream.
[Android Software Development] regaw_leinad:
Updated to 1.3.0.0 :D
[Android Software Development] regaw_leinad:
Anyone else developing with this care to share what they are building? I'd love to hear some of the projects you guys/girls are working on that utilize this library and add it to post #2!
[Android Software Development] pkfox:
Hi there I'm a professional c# developer and am very interested in your work, will this library work with Android tablets ? I have an Asus Transformer TF101

Good work
[Android Software Development] regaw_leinad:
This should work, I actually haven't tested this with any tablets because I don't own one, but most of it should work. There are also quite a few things I have noticed that I can add/improve upon in AndroidLib, such as the internal device management (I might just make this run an internal device management loop on a separate thread with DeviceStateChange events or something similar), but that update wouldn't be out for quite some time while I develop it. The example projects in the OP aren't very in-depth, but I documented it quite well, so you should get a good feel for it if you take a look at the documentation.
[Android Software Development] pkfox:
Thanks for the quick reply, have downloaded the lib and will play with it later

Thanks again
[Android Software Development] amoamare:
I wanted to thank you for this, While I personally haven't used it in any projects just yet. I wanted to share a picture with what this can do. I will also be sharing the source code later once I clean it up..

There is one function I would like to see added, well more of an event if you could. That is a connect/disconnect event. This way I don't have to jump through hoops to create one :) that would be much appreciated.

As you can see this lib works very well :) I'm not rooted on this device so no busy box commands and of course -1 means false Ill add a few more shots of the push/pull file system etc. :)
[Android Software Development] regaw_leinad:
Man that's awesome, thanks for making such a cool display with it. I'm slowly working on an internal device management loop that will have device state change events. Until then though, making them on your own will have to do ;)
[Android Software Development] amoamare:
That's not a problem if i manage to get a working disconnect/connect event working well with this Ill send you source it might help you. I already have my own full API working with one, but it only works with 1 device connected at a time since it doesn't use any java. I do like the fact that I cant have multiple devices connected and choose what one I wish to make a connection with.

Also while I did look a little I didn't notice a license usage, I would like to use this in a possible free/commercial software and would like to know what restrictions if any might apply.
[Android Software Development] amoamare:
Just a quick update, this locks up on the LG LS670 Optimus S from Sprint :( doesnt get past

Device = _androidController.GetConnectedDevice(SerialNumber);

SerialNumber = MEID of the device.

Tried the EVO4G root tool you had as well just to verify if it would connect to that, it locks up the software as well.
[Android Software Development] regaw_leinad:
Ah thanks for the info, can you run THIS with your phone plugged in? I'll try to add support for that phone. My guess is there's an error parsing the mount point output.

EDIT: I removed the upload form, but you can upload it anywhere and pm me the link.
[Android Software Development] amoamare:
Hmm I have a ton of androids, Ill be doing some test's on about 100+ different androids, if you like I could run that tool on each device, or just run on problem ones and place on my server for you.

LG LS670 Optimus S

Folder For Uploads

If i have any other devices having issues ill post the name of the file here etc for you to grab the information.
[Android Software Development] OmarBizreh:
Any plans for a new update!?:confused:
[Android Software Development] regaw_leinad:
Yes, I'm working on the internal device loop on a different branch, givin me some trouble though lol.
[Android Software Development] OmarBizreh:
great, waiting for it to finish :D

by the way I will be happy to help if you needed anything :)
[Android Software Development] RaVe-N:
Hi there.

Thanks so much for this dll. It's certainly made my life easier.

Here's a little app I made for quickly flashing boot.img files to your phones boot partition.

Was sick of all the roms I've been downloading just giving you batch files to load the files with and whipped this up.

Can only confirm that it works with my HTC One X, and for the love of all that is whatever don't blame me if you use it and it screws things up... blah blah blah LOL

It's quick and dirty but It's so much nicer than command line bashing...

https://dl.dropbox.com/u/8823313/HOXFlash.zip

One thing to note is that I had to create ADB commands to make my device reboot (including reboot to bootloader and recovery) as the device.Reboot, RebootRecovery & RebootBootloader did not work.

Cheers! :victory:
[Android Software Development] OmarBizreh:
is there any chance my App will be included in your second post!?
[Android Software Development] :
please ignore all my PMs, lol.. I just realized I really didnt have to run that stuff as root.. #oops great work, cant wait to enjoy the future updates :D
[Android Software Development] dbarrera:
Can anyone help me out here? I'm trying to add all Android connected devices to a combobox, so far the code is like this:

Dim model As String = ""
Dim totalDevices As Integer = 0
android = AndroidController.Instance
totalDevices = android.ConnectedDevices.Count

If (android.HasConnectedDevices) Then
For i As Integer = 0 To totalDevices - 1
serial = android.ConnectedDevices(i)
device = android.GetConnectedDevice(serial)
ComboBox1.Items.Add(device.BuildProp.GetProp("ro.product.model"))
Next
End If

And I get an ArgumentNullException: Value cannot be null. Parameter name: Item and it suggests to create a new instance of the object. Anybody care to help? Maybe some problem with the variable being set as a class variable and not in the Sub?

UPDATE: Nevermind, found the problem, adb detected the device as offline (first time I get that). Anyways, I reconnected the device and everything is working again... Guess I should restart at form load?
[Android Software Development] amoamare:
I don't know VB that well lol here you go.

public partial class MainFrm : Form
{
internal Thread KillStartAdbThread;
internal Thread GetConnectedDevicesThread;
internal AndroidController AndroidController;
internal Device AndroidDevice;

public MainFrm()
{
InitializeComponent();
}

private void MainFrm_Load(object sender, EventArgs e)
{
lStatus.Text = "Killing old instances of adb...";
//Throw this on a thread.
KillStartAdbThread = new Thread(KillStartAdb);
KillStartAdbThread.Start();
}

void KillStartAdb()
{
foreach (var p in Process.GetProcessesByName("adb"))
{
p.Kill();
}
AndroidController = AndroidController.Instance;
lStatus.Invoke(() => lStatus.Text = "Getting list of connected devices...");
GetConnectedDevicesThread = new Thread(GetConnectedAndroidDevices);
GetConnectedDevicesThread.Start();
}

void GetConnectedAndroidDevices()
{
if(!AndroidController.HasConnectedDevices) return;
for (var index = 0; index < AndroidController.ConnectedDevices.Count; index++)
{
var serialNumber = AndroidController.ConnectedDevices[index];
var func = new Func<bool>(() =>
{
AndroidDevice = AndroidController.GetConnectedDevice(serialNumber);
return true;
});
bool connected;
TryExecute(func, 3500, out connected);
if (!connected) continue;
cmbConnectedDevices.Invoke(() => cmbConnectedDevices.Items.Clear());
cmbConnectedDevices.Invoke(() => cmbConnectedDevices.Items.Add(AndroidDevice.BuildProp.GetProp("ro.product.model")));
}
lStatus.Invoke(() => lStatus.Text = "All devices listed in combobox...");
}

internal T Execute<T>(Func<T> func, int timeout)
{
T result;
TryExecute(func, timeout, out result);
return result;
}

internal bool TryExecute<T>(Func<T> func, int timeout, out T result)
{
var t = default(T);
var thread = new Thread(() => t = func());
thread.Start();
var completed = thread.Join(timeout);
if (!completed) thread.Abort();
result = t;
return completed;
}

}

public static class ControlExtensions
{
public static void Invoke(this Control control, Action action)
{
if (control.InvokeRequired)
{
control.Invoke(new MethodInvoker(action), null);
}
else
{
action.Invoke();
}
}
}

Attached is source.
[Android Software Development] amoamare:
Sorry one issue with the code, you will want to place

cmbConnectedDevices.Invoke(() => cmbConnectedDevices.Items.Clear());

Out side of the for loop so

if(!AndroidController.HasConnectedDevices) return;
cmbConnectedDevices.Invoke(() => cmbConnectedDevices.Items.Clear());

If you dont you will just get 1 device connected and it will be the last device it finds.
[Android Software Development] dbarrera:
Clearly that's C#, but I understand the code... Thanks!
[Android Software Development] amoamare:
Yeah sorry i was tired, i was meaning i dont know vb that well but here is source from C# should be able to convert to vb pretty easily
[Android Software Development] varun.chitre15:
@Daniel

Any plans to port this to Qt and pave a way for a cross platform library? ;)
[Android Software Development] regaw_leinad:
I've actually been thinking about that, but I may try and rebuild this with linux/mac android binaries as well and try to compile against the Mono framework and see if that will work. But yeah, Qt would be ideal.
[Android Software Development] crazykiddo:
Love the lib :P

question: how do you install apk as system app? do I need to use adb shell for that?

any1 with a code snippet they would share?

thanx
[Android Software Development] crazykiddo:
I figured it out :D
[Android Software Development] redwiz666:
i got a question about the AAPT wrapper. is there a way to retrieve certain information? All i was about to find are comparisons to see if it equals a value. for example i am trying to retrieve the app name.
[Android Software Development] Infinimint:
Any plans on making a similar library for Java? I'm not aware of anything like this currently, and it would be multi-platform (besides using Mono of course).
[Android Software Development] rivelta:
looks interesting , my master told me to learn about c# because its have more efficeient using memory than java. im gonna learn it with your guide.thanks
[Android Software Development] klaydze:
You save me lot of time searching on how to get all the devices attached to a computer.

Is it ok to use your dll when deploying my app commercially?

Many thanks and hope more to come
[Android Software Development] regaw_leinad:
It's alright with me, but it does include Google's adb and fastboot binaries, as well as the required libraries that they use. Nothing bad has come of that yet, but I thought you should know. In the new version of this library I am working on, I will have the user/developer supply those binaries so I don't need to worry about issues with Google.
[Android Software Development] klaydze:
Thanks for allowing me to use your dll. :D

Its fine with me. I'm planning to have a single computer where I can sync the device. All google adb, fastboot and libraries are already there.

Thanks!
[Android Software Development] klaydze:
What would be the best approach in pushing a file from pc to device using the dll?

Edit

I ended up using Adb and AdbCommand class to push file from pc to device. :)

Thanks
[Android Software Development] Goatshocker:
Isnt it time for a new release soon? Man, youre a bigger slacker than me ;)
[Android Software Development] regaw_leinad:
Updated AndroidLib to 1.5.0.0 :D

Added Device.FastbootReboot()

Added Device.PushFile()

Fixed All Reboot Bugs

Added Locking for better thread safety

Removed unneeded dependencies
[Android Software Development] amoamare:
There is a issue with InstallApk(String); it always reports that the apk installed no matter what.

Thanks for your hard work man.
[Android Software Development] regaw_leinad:
Ok, I'll look at that again today.
[Android Software Development] regaw_leinad:
Updated to 1.5.1.0 to fix the Device.InstallApk(string) bug where it always reported as installed.
[Android Software Development] OmarBizreh:
Been waiting for an update for ages, thanks :)

By the way I recall the last version was 1.3.0.0, where did 1.4 go :p
[Android Software Development] regaw_leinad:
Haha, I'll just call it an "internal" update ;)
[Android Software Development] klaydze:
Thanks for this update. :)
[Android Software Development] Goatshocker:
Nice, just in time for my latest additions to Quick ADB :)
[Android Software Development] Johrans:
Thanks man
[Android Software Development] krhyan2:
kAPK2 Drag & Drop APK Installer

kAPK2 Drag & Drop APK Installer Final

SIMPLIFIED Apk installer for any Mobile running on Android OS.

USB Debug mode and Unknown Sources must be Enable

How to use:

Choose any apk you want to Install

Drag and Drop

Download

.NET framework 4.0 is required for this Application to work

Whats New:

Multiple Install now supported. Multiple drop

Simplified GUI

Movable UI.

Force APK (-r) reinstall the app, keeping its data

APK File Recognition

Mobile Product Recognition

Fade in Fade Out animation

Balloontip Notification.

InstallerShield release

Artwork by: Arclight​
[Android Software Development] amoamare:
Bug - Well not really a bug with your code, more like Samsung. Galaxy S3 4.1.1 stock rom line 65 in the build.prop is

[hw.cabl.version]: [1.0.20120512

]

AnrdoidLib crash's due to the ] being below. Temp fix that i put into play was to add || temp == "]" continue. In the code. While this fixed it.

There probably is a more right way of doing it. It still gets and formats the property correctly.

Thanks again.

Edit: Actually I ended up making the code like this just to be on the safe side.

if (string.IsNullOrEmpty(temp) || temp.StartsWith("*") || temp == "]" || temp == "[")
continue;
[Android Software Development] regaw_leinad:
Ah, good to know, I'll put a fix in for that. Can you attach the full build.prop here so I can run some full tests with it?
[Android Software Development] amoamare:
i attached both the getprop and build.prop

Sorry i was tired i meant to say that line was in the getprop, that's why i attached. I also included the build.prop so you can review that as well.
[Android Software Development] regaw_leinad:
Hahaha, I was tired too, I actually meant getprop lol

Thanks for both!