OpenStreetMap logo OpenStreetMap

Using a phone running Android OS as a data collector for an RTK-enabled GNSS receiver, I ran into a fairly small but annoying inconvenience with getting data files from it on a Windows machine.

On Windows, you can’t mount a phone’s file system as an actual removable drive (don’t confuse that with seeing its file system in the File Explorer), so automating it with built-in command-line file tools isn’t an option. File paths to the data folders of Android apps are ridiculously long, so traversing them manually is another hassle.

However, it’s still possible to do that using the Android Debug Bridge tool, a part of the SDK Platform Tools.

After installing SDK Platform Tools, you should be able to use the adb command in PowerShell or classic Command Prompt batch files.

Knowing the full path to a folder where your data collector app (LocusGIS, SW Maps, etc.) stores files you need to download regularly, you can get a list of that folder’s contents by calling adb shell ls command with the full path to that folder as a parameter.

Downloading a file is as easy as calling adb pull with the full path to the file you want to download. This process can be made more or less interactive if you create a script that lists all the folder contents, then prompts you for a name, and then downloads the file by the name you entered. The target file name or path can also be specified as another parameter. It’s even easier if the data collector app uses the same filename every time, or if you save it under the same name.

For all that to work, you’d have to enable USB debugging on your mobile device and grant permission for the Windows machine to use it when you first attempt to utilize the adb. However, it would save you the hassle of switching on the File Transfer mode every time you want to access the phone’s file system.

This information might look trivial to someone familiar with Android development and setup, but there are plenty of people who have no idea of what adb is capable of.

Email icon Bluesky Icon Facebook Icon LinkedIn Icon Mastodon Icon Telegram Icon X Icon

Discussion

Log in to leave a comment