1

I want to copy files from my pc to my android device using WPD-Api.

I am able to copy to root folder but i am not able to copy to folder inside root.

I tried to enumerate content in device but that also not working. I tried using link but was not useful. I am sharing my code snippet also

foreach (var device in deviceCollection)
            {
                try
                {
                    device.Connect();

                    var root = device.GetContents();
                    int i = 0;
                    PortableDeviceFolder sdCardRootFolder = null;
                    PortableDeviceFolder DCIM = null;
                    foreach (var deviceObject in root.Files)
                    {
                        i++;
                        if (deviceObject is PortableDeviceFolder)
                        {
                            sdCardRootFolder = deviceObject as PortableDeviceFolder;


                        }
                    }

                    if (sdCardRootFolder != null)
                    {
                        device.EnumerateContents(sdCardRootFolder);

                        foreach (var deviceObject in sdCardRootFolder.Files)
                        {
                            if (deviceObject is PortableDeviceFile)
                            {
                                if (deviceObject.Name.StartsWith(DeviceSerial))
                                {
                                    connectToDevice = true;
                                    break;
                                }
                            }
                        }
                    }
HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
vishnu
  • 11
  • 3

0 Answers0