Click here to Skip to main content
13,090,178 members (50,760 online)
Rate this:
Please Sign up or sign in to vote.
See more:
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 3:56am
Updated 17-Jun-13 4: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
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.170813.1 | Last Updated 17 Jun 2013
Copyright © CodeProject, 1999-2017
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