8

My Android app produces some files that I need to synchronize with my main PC program and the other way around. The common way I do this is using a FTP account where both my Android app and my PC program gets the latest version of the files, and this works just fine. Some of my clients does not have internet access on their Android devices, and so will have to synchronize with my program by connecting to the PC with a USB cable. For this I have a routine in my PC program that will synchronize the files on a specified folder on the Android device. The problem is that this method only works if the Android device can be mounted as a drive, and thus be assigned a drive letter by Windows.

Some devices, especially tablets running Honeycomb (I have experienced this on Samsung Galaxy 10.1 tab and Lenovo Thinkpad Tablet) will not be mounted as a drive, but instead be connected as a Windows Portable Device (WPD). In this case I cannot access the device from my program (which is written in Delphi) and thus my routine for synchronizing my files does not work.

My routine has to know a specific location of the folder to synchronize with to work, so if I could transfer the files from the device to a temporary folder on the PC, synchronize them and possibly transfer the files back on the device, that would solve my problem.

Can anyone suggest a way that I can transfer the files from the WPD device to a folder on my PC and back again? It has to be automated as my clients cannot transfer the files manually. Alternatively, is there a way to force a WPD device to function as a normal external drive and be assigned a drive letter?

Cœur
  • 37,241
  • 25
  • 195
  • 267
Daniel
  • 924
  • 1
  • 14
  • 31

2 Answers2

2

You can use the WPD Automation API from your PC application. There's documentation available from the above page, although I haven't looked for any code samples. (I haven't had the need; for the apps I write for Android that have to synch with PCs, the devices all work as USB drives or can synch through Google documents (eg., contacts and calendar info).

Ken White
  • 123,280
  • 14
  • 225
  • 444
  • Do you know if the WPD Automation API works with Windows XP? There is no documentation on this in the API, but it says [here](http://msdn.microsoft.com/en-us/library/windows/desktop/dd388998(v=VS.85).aspx) that "The WPD Automation Object Model is only supported in Windows 7" - does that mean that I can't use this approach on XP machines? – Daniel Nov 25 '11 at 09:59
  • y but u need Windows Media Format 11 SDK redistributable. WPD is built-in on Vista+. – Sheng Jiang 蒋晟 Aug 25 '17 at 03:52
1

One way to do it would be to go here and look at "adb push" and "adb pull" commands, this should work so long as the android device is connected via USB, but you have to download the SDK and get the files you need as a "special app cocktail" that you will give to the customers in order for sync-ing to work. I hope it helps!

  • 1
    -1 I'd suspect that getting the client to install the entire Android SDK (and JDK) first in order to synch files isn't going to work, especially since the clients in question have no internet access. – Ken White Nov 23 '11 at 00:39
  • To clarify: Even if you set up a "special app cocktail", this is no different than asking them to install an ftp server on each machine that your Android device can connect with; there are better ways. – Ken White Nov 23 '11 at 01:04
  • @KenWhite well, there's more than one way to skin a cat... we don't know how the PC sync app is being installed(maybe install Android stuff and JDK at that time as well?), assuming that the client doesn't care "how" it's done, but needs to be done, it can work. I'm not saying that it's the best solution, but that is a possible solution. Honestly, I don't understand your -1, but I respect your opinion. –  Nov 23 '11 at 11:44
  • 1
    It's basically like telling them to install a virtual machine, install Linux, download the source for a specialized file system, build it, and install it in order to transfer files between an Android and Linux system. It's just not what you expect your client to have to do to work with what should be a relatively simple process, unless there is no alternative. In this case, there is a relatively simple one available (in fact there are several that would be easier than installing the JDK/ADK and using ADB manually from the command prompt. – Ken White Nov 23 '11 at 12:02
  • that's when automation comes into play... double-click install file, press install => voila, who said anything about linux, VM's or building source? –  Nov 23 '11 at 12:12
  • 1
    To clarify: all I'm saying is: "this is a possible solution(NOT the solution)", and you come in and say: "it's a TERRIBLE solution", I couldn't agree with you more! but we don't always have the best solutions, hopefully the op will jump in and answer his own question or someone else will provide a better solution, I'm interested to know a better one myself!! –  Nov 23 '11 at 12:56
  • In some scenarios this is the solution. Like for example in a java client for screen mirroring, they require you to download the Android SDK. – user30478 Jul 05 '18 at 19:03
  • 1
    @user30478: Except the question asked is not about screen mirroring, and does not require downloading the Android SDK. And this is not a Java client question, it's a Delphi question. – Ken White Aug 23 '19 at 00:39