Transferring files from Android WPD device to PC

一曲冷凌霜 提交于 2019-12-21 09:39:09

问题


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?


回答1:


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).




回答2:


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!



来源:https://stackoverflow.com/questions/8234407/transferring-files-from-android-wpd-device-to-pc

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!