Click here to Skip to main content
11,704,768 members (48,686 online)
Rate this: bad
Please Sign up or sign in to vote.
See more: C# 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 3:56am
Edited 17-Jun-13 4:08am
Prasad Khandekar at 17-Jun-13 10:37am
Try issuing adb shell input keyevent 23 command from another thread.
raghav.softobiz at 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 Sergey Alexandrovich Kryukov 679
1 OriginalGriff 455
2 Andy Lanng 245
3 CPallini 242
4 Maciej Los 225
0 OriginalGriff 8,864
1 Sergey Alexandrovich Kryukov 8,245
2 CPallini 5,189
3 Maciej Los 4,726
4 Mika Wendelius 3,606

Advertise | Privacy | Mobile
Web01 | 2.8.150819.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