Programmatically access files on android device from PC

11,878

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;
Share:
11,878
Brian Tacker
Author by

Brian Tacker

SOreadytohelp

Updated on June 09, 2022

Comments

  • Brian Tacker
    Brian Tacker almost 2 years

    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.