[HOW TO] Make your own Android Toolkit for Windows in C# - Make it to your liking!
[HOW TO] Make your own Android Toolkit for Windows using C#
In this tutorial it will show you how to use Windows C# to create your very own toolkit for use of simple ADB commands.
- Rebooting your Device.
- Rebooting to Recovery/CWM or Bootloader.
- Installing APK's directly to your device.
- Installing general files to the SDCARD
- Pushing and Pulling files
Or if you look into it enough you can Implement such features as:
- Rooting your Device.
- Unlocking/Locking Bootloader.
- File Permissions.
( These won't Be covered in this Tutorial, as they require much more time, especially Rooting. )
- A set up Visual C# Studio ready to use on your PC. It can be downloaded here : http://www.microsoft.com/visualstudio/eng/downloads
- General knowledge about C# such as using buttons, text boxes and the actual studio.
So once you have set up your Visual C# studio, create a windows Form application and mess around with the user interface a little if you like to make it to your taste.
So here is a picture of my preview:
I have applied a few different ADB tasks buttons as you can see, Including APK install using a Textbox to store your chose directory of the selected file.( As well as a few colour and form name changes to make it more appealing )
Writing the ADB commands to the chosen Buttons in your application.
Now we want to click on the ADB reboot
button until it changes to the code layout as such...
Now we have this layout we want to add the namespaces :
These will allow use for CMD and Process features.
Adding ADB commands to the Buttons
How you have your ADB reboot button code ready to write to.
Use this function: and insert it in between the two Curly brackets
var process = Process.Start("CMD.exe", "/c adb reboot");
MessageBox.Show("Device is Now Rebooting..");
The line uses CMD.exe as the process which will run it as an application and use the /c (command) to execute "adb reboot".
Which will reboot the connected device as long as it's android..
So once you have gone through using the correct ADB commands your application code will look like this..
The ADB wont work yet when running a debug version, so don't try and execute any commands yet.. The adb.exe and a couple of other files need to be stored in the same folder as your toolkit as a resource for ADB to run off of.
Using Textboxes and OpenFileDialog to Install .APK files.
So once you have clicked the two buttons and textbox.
Setting you up ready to code it will look like this:
Assuming you have added OpenFileDialog to your Form Design!
We can now add code to the 2 buttons and text box.
It will look like this after adding the following to segments of code.
Add this to Open APK button:
openFileDialog1.InitialDirectory = @"C:\";
And add this to Install APK file button:
openFileDialog1.Title = "Select your APK..";
openFileDialog1.FileName = "Choose File..";
openFileDialog1.CheckFileExists = true;
openFileDialog1.CheckPathExists = true;
openFileDialog1.Filter = " .APK|*.apk";
if (openFileDialog1.ShowDialog() == DialogResult.OK)
textBox1.Text = openFileDialog1.FileName;
var process = Process.Start("CMD.exe", "/c adb install " + textBox1.Text);
Now' that is almost it!
MessageBox.Show(".APK is Installed", "", MessageBoxButtons.OK, MessageBoxIcon.Information);
Once you have saved and Built a release version of the tool.
Put the .exe from release of the saved directory into a folder ALONG with ADB.exe, ADBWinAPI.DLL and ADBWINUSBAPI.DLL
These ADB files a part of the Android platform tools from the SDK manager. You should already have these if you want to do this process
- If not just google them or download the SDK manager and find them.
Now That's it!
I think I have covered most parts if you want to write your own processes for ADB to execute feel free to do so..
I thought it maybe nice for people who liking personalizing their devices to also personalize toolkits for themselves also!
Thanks and Enjoy if you have any Issues or problems feel free to ask!
You can keep upto date on anything I'm doing via Facebook http://www.facebook.com/Quantumcipher
or Youtube https://www.youtube.com/user/QuantumCipher