Click here to Skip to main content
11,920,641 members (59,083 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# Mobile Android
Hello Guys,

I am working on android ADB commands to take a back up from android device. I use this command to take backup "-s xxxxxxxxxxxxxx backup -apk -all -f backup.ab" from Mobile device when I used this command a pop up display in mobile (Take backup/Do no take backup). I touched the take backup and everything working fine. Now when I have on android dongle when I used same command to do this then how can I click on options which I got in mobile because android stick/dongle don't have screen. I am stuck with this issue.

Sorry for wrong engish.

Below are the code

Process p = new Process();
           p.StartInfo.FileName = @"adb.exe";
           p.StartInfo.Arguments ="-s xxxxxxxxxxxxxx backup -apk -all -f backup.ab"; //"   ";
           p.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
           p.StartInfo.CreateNoWindow = true;
           p.StartInfo.UseShellExecute = false;
           p.StartInfo.RedirectStandardOutput = true;
           p.StartInfo.RedirectStandardError = true;
           string regular = p.StandardOutput.ReadToEnd();
           string error = p.StandardError.ReadToEnd();

Posted 17-Jun-13 4:56am
Edited 17-Jun-13 5:08am
Prasad Khandekar 17-Jun-13 10:37am
Try issuing adb shell input keyevent 23 command from another thread.
raghav.softobiz 17-Jun-13 11:32am
Thanks for showing me right path.

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Using Process.Start is no different than if you launched the command yourself from Explorer. What you launch is not part of your process. It runs completely independent of your code.

If there is no command line argument to tell it what to do, then you'll have to use something along the lines of SendKeys[^] to send appropriate keystrokes (not mouse clicks!) to the other application to get it to do what you want. Be warned...SendKeys is not reliable!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
0 OriginalGriff 548
1 Dave Kreskowiak 245
2 phil.o 170
3 KrunalRohit 134
4 F-ES Sitecore 130
0 OriginalGriff 6,778
1 KrunalRohit 4,530
2 Sergey Alexandrovich Kryukov 3,203
3 George Jonsson 2,815
4 Suvendu Shekhar Giri 2,181

Advertise | Privacy | Mobile
Web02 | 2.8.151120.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100