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?
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).
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!
Related
I have wi-fi source that could be used by smartphone. To work on my notebook I connect to internet through wi-fi by smartphone and use usb cable tethering. Internet works, but I didn't find way to transfer files to smartphone. I need to interrupt tethering and transfer files.
Is it possible to transfer files without interrupting tethering?
It is possible on Android if you use another file transfer protocol instead of MTP. For example, you could run an ssh server on your phone - SSHHelper app works fine, then use SFTP from your computer to browse your phone's files - I like WinScp on Windows.
I recommend: NitroShare
Benefits:
It's open-source. Therefore they are not planning to earn money from it, i.e. it will not show ads, it will not ask for extra permissions, and its source code is open to everyone.
... and this means it's also free.
According to F-Droid it has no "anti-features", i.e. it does not depend on commercial software, services or libraries, it does not even use Google Play Services and it does not connect to any cloud or any commercial server.
It's easy to use and powerful, it detects any device in a local network automatically and you can send single or multiple files or whole directories at once.
It works with any kind of network, which means it works with tethering. I use it to exchange files between my laptop and my Android phone without interrupting tethering.
It's bidirectional: you can send files from PC to phone and viceversa.
It's cross-platform: it's available for Android devices and for Windows, Linux and Mac-OS.
Some links:
Download from Play Store
Download from F-Droid
Desktop version
Source code
Download ES FILE EXPLORER on your phone go to NETWORK tab and then view on pc or remote manager then click on start it gets you an ip address type it either on internet explorer or on THIS PC tab when you lunch it
I have two folders on a desktop PC running windows 7, I want to connect an android tablet to that PC by bluetooth and move a file from the android tablet to one of the folders on the windows PC. and get a file from the other folder on the windows PC and copy that to the android tablet.
is it possible to do this without having to run any software on the windows PC. just only running the android app and using it to access the two folders on the windows PC?
if using bluetooth is not the best way to do this, is there a better way?
i wanted to avoid having to make a java program that i have to run on the PC side. that means having to install it and make sure that it is running for the file transfer. would rather just deal with the tablet only.
i am not vary familiar with bluetooth and wanted to get some opinions on using it for this situation, any ideas?
If you are going to use bluetooth, from personal experience you need to interact on both the computer and tablet. As a confirmation window for a file transfer appears on either the computer or the tablet.
Wireless can be a better method of transferring files as I believe you can get a file manager app for android so you can easily manage files between desktop and tablet.
Some recommended file managers are available here - http://android.appstorm.net/roundups/utilities-roundups/top-10-file-managers-for-android/
Hope this helps.
I am looking for a solution which uses Android API to transfer a text file from an Android powered device to a computer through USB cable. I have found USB host but I cannot use this because the computer can not act as a device for the Android host.
Do you have any suggestions how I can achieve this?
I have solved this problem by using adb status-window to continuously check for device status, and when a new device is connected, the required files are transferred to the computer using adb pull command.
In order to achieve a portable solution (i.e. to run independently of Android platform), I just copied the files 'adb.exe' and 'AdbWinApi.dll' into my application and used the adb from there.
Had similar problem where a software installed in PC needed to be able to access file inside the android phone through USB. After long research here is what worked for me (not sure if this is the best solution but it worked). Windows has Windows Portable Device(WPD) API which can be used to enumerate contents of a device through USB (and copy files between client and device).
There are few implementations in java
http://code.google.com/p/jmtp/ (works well but doesnt support copy function from device to pc though there is some support available to do this with source code)
another one is jusbpmp (available in google repository)
(if somebody finds a well documented and maintained implementation do share)
but since jmtp didnt work for me (copy function source compilation(for 64bit OS) failed), wrote C# program from scratch to copy files from device to PC. here is a nice tutorial
https://github.com/geersch/WPD/blob/master/src/part-3/README.md
You can write an app which will use http to contact your pc and send (POST) data to a known endpoint.
Keep in mind that the app will only have access to the data belonging to the app. You will not be able to access an arbitrary file from the file system
I've built apps that connect to a server. But this time a client has asked for an app with no need to connect to a server to update content (images,videos,text).
It will be Android tablet to a Windows laptop via USB. It will be for end user no dragging and dropping into specific folders using USB debugging.
I was thinking I may need to build an app for the laptop (content manager) and then the app for tablet.
Is a framework out there that could jump start this?
Thanks
You can setup a batch script that runs some adb commands when the tablet is plugged in. Then you could use 'adb push' to push some update files onto the tablet, and the app could check for these files when it runs and take appropriate actions with them.
This would probably be best as a desktop application (not an Android app). The tablet's SDCard is already mountable as a USB mass storage device, so why not just have a desktop application mount that drive, move the files into the correct folder, and eject the drive? Then when the tablet app is opened, the new files are there.
When an Android device is plugged in to a PC (through USB?), is the internal file system mapped to a drive letter on the PC? So that one can copy files to and from the Android under Windows?
And, can Emulator simulate the situation when it's plugged in? How?
Thank you in advance!
Yes, it CAN be mapped to a drive letter. It was much easier with something like a Droid X (Android 2.3), since it would show up as a mass storage device (disconnecting the card from your phone in the meantime), but it's also possible on newer phones such as the LG G3 if you're willing to install 2 free programs, which you probably would like to have anyway.
ES File Explorer - Remote Manager (FTP Server)
First, you need a file manager, not only because the built-in one is useless, but also because you need an FTP server. Install "ES File Explorer" on your Android Device. Then in the options, turn on the "Remote Manager" option, which will activate the FTP server and show you its local address like "192.168.1.3:3721. You can now access your phone as an FTP site from your computer when on your local WiFi network.
Net Drive - Remote Drive Mapping Utility
Next, all you have to do is install NetDrive: http://netdrive.net/ It's freeware and seems to be used by a lot of companies, because it lets you map cloud storage to local drives. That will allow you to map your FTP server on your phone as a local drive.
Don't bother trying to map an FTP site with explorer. First, you may run into a problem that's apparently caused by Chrome, where you can't even add an FTP network location. You'll get an unexpected error telling you the path format is invalid. Interestingly, that is solved by opening the registry editor, then under [HKEY_CLASSES_ROOT\ftp] add a key named "ShellFolder" with string value "{E436EBB6-524F-11CE-9F53-0020AF0BA770}". The error will immediately cease occurring, with no restart or any other action required. Just go back in and add the ftp network location. That, however, still does not allow you to map it to a drive letter, which is why you need NetDrive.
As of Android 4, the wise ones have removed USB Mass Storage support for accessing the internal phone memory. So you no-longer get direct block-access (or a driver letter in windows). You can usually choose on the phone between MTP, or PTP (Media / Photo Transfer protocols) for whichever your OS supports better.
If your device has removable storage it should still support USBMS (with a drive letter) for that partition. At least Android still supports that, but your Manufacturer or Carrier-ware may still fail you here.
However, when it comes to the phone memory, there was a trade-off made in Honeycomb. Unified storage prevents wasted space (no more separate storage for phone / data, and having one fill up first and having confused frustrated users trying to move apps to SD, etc). The trade-off requires that:
Android can no longer ever yield up the storage for the host PC to
molest directly over USB.
Initially for Mac and Linux where support for MTP/PTP has been slower, You can use an FTP app on your phone. But now there is an increasing number of Desktop (PC/Mac/Linux) apps that understand and support the MTP or PTP protocols. You just don't get block access and so you can't get a drive letter without some hackery / third party software.
There have been hacks over the years to make FTP or WebDav or some other protocol work behind a windows drive letter, and something like could still work work for these MTP/PTP protocols, but I have yet to see any such consumer usable software for windows.
If your Linux distro doesn't include MTP support, gMTP seems pretty popular.
You can mount the device via USB but (in Win7 at least) it doesn't appear to have its own drive letter; rather it's treated like a camera or another media device. It doesn't mount automatically; you generally need to "opt-in" in the notification area with something like "Turn on USB storage"
Don't know about emulators.
Using Eclipse you can push and pull files to the emulator using the DDMS perspective. Doing similar on a real device, iirc will require root access to the device, at least to get to the 'sensitive' areas.
The SDK tools will also provide a way of push and pull via the command line.
possible with https://github.com/billziss-gh/sshfs-win
difficult finding good sshservers for android, know that at least one works but doesn't autostart at wifi and have to manually restarted, which it was possible to "come home from work, drive is connected"
this server seams to work fine
https://play.google.com/store/apps/details?id=net.xnano.android.sshserver.tv&hl=en_US
Wanted to backup(incremental) android device using Areca backup utility which requires src and dest to have drive paths.
After trying various methods like adb-sync, Syncthing, webDAV, etc. Got it working with ftp sharing.
Download any ftp server app. I used "WiFi FTP Server" by Medha Apps on Playstore to create a ftp server something like this- ftp://username:*#xxx.xxx.xxx.xxx:yyyy where username can be set in app settings and xxx is i.p. with yyyy as port number.
Map ftp URL to drive path by using free app- "DirectNet Drive"
Use the drive as if it's in your own system, though it will be slow being wireless.