Transferring files from Android WPD device to PC
Asked Answered
C

2

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?

Cathrin answered 22/11, 2011 at 22:0 Comment(0)
C
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).

Cameo answered 23/11, 2011 at 0:44 Comment(2)
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 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?Cathrin
y but u need Windows Media Format 11 SDK redistributable. WPD is built-in on Vista+.Mou
K
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!

Krispin answered 23/11, 2011 at 0:35 Comment(8)
-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.Cameo
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.Cameo
@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.Krispin
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.Cameo
that's when automation comes into play... double-click install file, press install => voila, who said anything about linux, VM's or building source?Krispin
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!!Krispin
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.Aeschylus
@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.Cameo

© 2022 - 2024 — McMap. All rights reserved.