Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I have a C# application that will need to access files that are on my android tablet, obviously I can just use the mounted drive letter for the storage but I will be deploying this at multiple locations and need a consistent way to access the files. I'm able to call ADB programmatically, but again, I am deploying it at multiple locations and can't install the SDK on every system.

So I guess I'm looking to either: 1) programmaticaly access the device using C# (or java) or 2) Use ADB without having to install the SDK at each location or 3) Find out the drive letter of the attached device programmatically

As you could have guessed I'm trying to make this as seamless as possible

P.S. An example of an application that works this way is HTC Sync, If anyone knows how that application does it that would be perfect.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
322 views
Welcome To Ask or Share your Answers For Others

1 Answer

Here's what I came up with for you to maybe start with.

var drives = DriveInfo.GetDrives();

var removableFatDrives = drives.Where(
        c=>c.DriveType == DriveType.Removable &&
        c.DriveFormat == "FAT" && 
        c.IsReady);

var andriods = from c in removableFatDrives
               from d in c.RootDirectory.EnumerateDirectories()
               where d.Name.Contains("android")
               select c;

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share

548k questions

547k answers

4 comments

86.3k users

...