/** * Copy test file to device. */ public static String copyToDevice(PortableDevice device) { String error = ""; try { // Try to find the data folder on the phone. String phoneDir = @"Phone\Android\data"; PortableDeviceFolder root = device.Root; PortableDeviceFolder result = root.FindDir(phoneDir); if (null == result) { // Perhaps it was a tablet instead of a phone? result = device.Root.FindDir(@"Tablet\Android\data"); phoneDir = @"Tablet\Android\data"; } // Did we find a the desired folder on the device? if (null == result) { error = phoneDir + " not found!"; } else { // Create remote test folder. result = result.CreateDir(device, "test"); string pcDir = @"C:\Test\"; if (COPY_FOLDER) { // copy a whole folder. public void CopyFolderToPhone (PortableDevice device, String folderPath, String destPhonePath) result.CopyFolderToPhone(device, pcDir, phoneDir); } else { // Or Copy a single file. device.TransferContentToDevice(result, pcDir + "foo.txt"); } } } catch (Exception ex) { error = ex.Message; } return(error); }