Many free software fans, if they were like me, breathed a collective sigh of relief when the Android operating system hit the market. Before receiving my first smartphone (a Samsung Blackjack running Windows Mobile 5.5, I believe, that I had to update to through a torturous combination of installing Windows XP on a partition, installing the phone drivers, then running an update program), I was a steadfast "PDA-and-cell" guy who proudly carried both devices on my belt like a pair of six-shooters. But that Blackjack showed me how nice it is to carry one device, and since receiving my first Android device (an original Droid I still use to this day), I can't imagine using a device with another mobile OS. Linux kernel, Java-based apps—these are all right up my alley.

But, like many great consumer Linux products (I'm talking to you, Sharp Zaurus), manufacturers assume in nearly every case that your "other" computer will run Windows. Now, it's easy enough to install Windows either on a separate partition to dual-boot or in a VM to run within Linux. But this is a bit like killing the proverbial fly with a bazooka. Web-based applications and "the cloud" alleviate some of these difficulties, yet it's still not an "out-of-the-box-after-a-quick-install-from-CD" process like it is for Windows users.

The good news is, with the installation or configuration of a few programs, it's pretty easy to get your Android device (all the steps in this article are equally applicable to phones and tablets unless stated otherwise) to play nice with your Linux boxen. In this article, I focus on files and a few approaches for making sure you always have an up-to-date copy of that spreadsheet or source file on your mobile device.

In the Cloud

The cloud computing movement has done a great deal to promote platform agnosticism, from consistent (Web-based) UIs to cross-platform APIs that allow applications to synchronize data. And with most users being constantly connected via 3/4G, Wi-Fi or wired networks to the Internet, cloud services have been one of the most hassle-free ways to make your data available across devices.

Dropbox

Of the free file-sharing services out there, Dropbox is arguably the most popular, perhaps because it's the simplest—no bells and whistles, no long, complicated feature list, just good old-fashioned cloud storage. And with support for both Android (via the application in Google Play at https://play.google.com/store/apps/details?id=com.dropbox.android&hl=en) and Linux, either for GNOME and other GTK-centric desktops (using the the Nautilus plugin from Dropbox shown in Figure 1 and available at https://www.dropbox.com/install?os=lnx), or KDE (via the excellent KFilebox—at the time of this writing, the project's home page lists 0.4.7 as the most recent version, http://kdropbox.deuteros.es, but the SourceForge page, http://sourceforge.net/projects/kdropbox, lists a version 0.4.8 that works very well—shown in Figure 2).

Figure 1. Nautilus Context Menu

Figure 2. KFileBox Menu and Config Window

Pointing each of the above at the same folder tree will help keep all your important folders close at hand. However, it's important to note the "official" Dropbox app above keeps an list of your files, but it doesn't actually sync up the files themselves—that is, if you upload a revised file to Dropbox from your Linux box, then later go off-line with your mobile device, the Android gadget will know that file changed, but you won't be able to view or edit it until you go back on-line. However, a free app called DropSync (https://play.google.com/store/apps/details?id=com.ttxapps.dropsync&hl=en) will do this for you (Figure 3). In addition, Dropbox is supported internally by a wide variety of individual Android apps, which will let you edit files directly from or save files directly to your Dropbox account. An example of this on my Transformer Prime is Epistle (https://play.google.com/store/apps/details?id=com.kooklab.epistle&hl=en), a very elegant Markdown editor, which automatically updates the list of files in its folder to a folder on Dropbox.

Figure 3. DropSync Config Screen

Box

Box, like Dropbox, offers users free on-line storage space accessible via a Web interface. Box also has an app in the market (https://play.google.com/store/apps/details?id=com.box.android&hl=en, Figure 4). One advantage of the Box app over Dropbox is that it automatically notifies you of updates to files. The Box service itself also has some nice features, some of which are available only with a premium subscription, including version management and integration with other Web apps, such as LinkedIn, SalesForce, NetSuite and Basecamp. However, it suffers from one of the same weaknesses as the official Dropbox app: when the app is on-line, it updates only information on the files in your Box account, rather than caching a version of the files. Although it does have an option to mark files to "Make Available Offline" (Figure 5).

Figure 4. Box Android App

Figure 5. Box "Make Available Offline" Menu

On the Linux side, although Box doesn't have a native client program available, it does permit access to your files via WebDAVS. This means you can set up a shortcut in Nautilus (by connecting via the "Connect to Server" option to dav://www.box.net/dav, making sure to select "Secure WebDAV" per these instructions: http://benjaminkerensa.com/2011/10/27/how-to-mount-box-net-securely-on-ubuntu-11-10) or Dolphin (for some reason I could not get the "Add Network Folder" dialog to connect, but simply typing webdavs://www.box.net/dav into Dolphin's address bar prompted my credentials and worked like a charm, as I proudly display in Figure 6). In some ways, I prefer this to being forced into using a proprietary client program; on the other hand, the Dropbox client for Linux does automatically update local copies of files, while Box's WebDAV access feature will require that you're on-line unless you take additional steps.

Figure 6. Box via WebDAVS

Google Drive

Some heralded the re-branding of Google Docs to Google Drive as the beginning of the end for Dropbox and its brethren (perhaps some still believe this to be the case). With the built-in editing capabilities of Google Docs behind it, Google Drive is certainly a killer tool for collaboration and productivity. I've used shared text documents and spreadsheets with clients and colleagues, and having an on-line place both to stash this important information as well as work on it in real time has been a huge time saver on more than one occasion.

But placing all your data in Google Drive isn't without its drawbacks. Google uses its own internal formats for the text documents, spreadsheets, presentations and drawings in Google Drive. While it's very non-evil about allowing you to download your files in Linux-friendly formats (even ODF for text and spreadsheets, huzzah!), it still involves conversion, which carries with it the risk of misconversion.

The recently updated Google Drive app at https://play.google.com/store/apps/details?id=com.google.android.apps.docs (yeah, I included a link, but if you've got an Android device, you've got it already, no?) is much improved from the initial versions, in which the document editor operated through Web-based text areas. Unfortunately, the spreadsheet editor still requires you to click an Edit link at the beginning of the row to edit the values in that row (Web-based text fields), shown in Figure 7. As for file management, like Box, Google Drive will save files locally for you to edit if you're off-line, but only if you select the Available Offline option for each file to which you'll need access. In addition, Google Drive also is supported by individual apps (like DropBox above). In addition to its own app, Google Drive is an acceptable storage place for Polaris Office (pre-installed on my Prime, shown in Figure 8) and Documents to Go.

Figure 7. Google Drive Android Spreadsheet Editor

Figure 8. Polaris Office Displaying Google Drive contents

Others

The below items also deserve special mention, and although they're not quite as widely known, accepted and/or supported across the Android community yet, each has some nice features that are worth a look.

Ubuntu One: Canonical's entry into the cloud storage and Web services game, it has the benefit of a commercial supporter of the Linux client. In addition, Ubuntu One goes beyond simple file synchronization and will have the ability in the future to keep some of your more data-centric applications (such as contacts and notes) up to date as well as stream music. The support is a little patchy (for example, it will synchronize contacts, but not calendar or task data, and only on Ubuntu at present), but Ubuntu One's promise of a "personal cloud" is certainly enticing.

Spideroak: if you're nervous about entrusting all your sensitive data to a service provider's BOFH's for all you know, Spideroak may be right up your alley. The service's biggest selling point is "zero-knowledge" encryption on all your data—that is, even though the company hosts it, even it can't break into your files. It also maintains a version history on files, a feature typically only for premium customers of other services. Finally, in addition to mobile (iOS, Android and Nokia N900), the company has comprehensive Linux support, providing clients in DEB (Ubuntu/Debian), RPM (Fedora/OpenSUSE/RHEL/CentOS) and even TGZ format for Slackware users.

On the Local Network

For the paranoid among us, there are concerns about leaving all your sensitive data in the hands of corporate overlords. Fortunately, there's options for even the most anti-corporate shell jockey to connect Android and Linux over a local network.

The "Linux" Way: SSHDroid

One option is to synchronize from the Linux side, meaning there needs to be a mechanism for your Linux box to see and manipulate the files on the Android device. SSHDroid (https://play.google.com/store/apps/details?id=berserker.android.apps.sshdroid&hl=en) provides a full SSH server for your device. As shown in Figure 9, starting this app displays a screen telling you everything you need to know, including your current IP address, the URL to connect to (it uses the SFTP protocol and defaults to port 2222) and the status of the server.

Figure 9. SSHDroid Main Screen

Having used this quite a bit to edit files directly over SFTP (one reason why I love kioslaves), I can say this is probably my favorite way to use my Linux and Android machines, for a couple reasons. One, it takes the least amount of setup: you install SSHDroid, start it up and go to a URL from the Linux machine. And, Bob's your uncle. Second, it's secure. Third, while I generally use it to edit files directly over SFTP, once you're connected, you can use an application like Unison or Krusader to synchronize files. And last, the performance for large transfers is not too shabby on my Prime.

That said, this method is best suited for those who use the Android device as a mobile extension of their desktop machine—that is, those for whom the Linux box is the boss. For those of us who do more and more computing on tablet and other mobile devices, it never hurts to have SSHDroid installed (it's free and takes up less than 1MB, rare nowadays). A more Android-centric solution is described below.

The "Android" Way: FolderSync (S/FTP, Samba, WebDAVS)

For those of us who are enjoying the freedom of browsing the Interwebs or writing from a hammock in the back yard (which, if you haven't tried it, I highly recommend) but still want to practice good backup procedures, FolderSync (https://play.google.com/store/apps/details?id=dk.tacit.android.foldersync.full&hl=en) is an excellent solution. It isn't open source, or even free, but at $2.29 for the Pro version, it's practically a no-brainer once you figure out what it can do for you.

And what is that? It will keep one folder on your device synced up with a folder on your Linux box over SFTP. You can opt to start the sync jobs manually, or schedule them, with useful options, such as limiting certain jobs (called Folderpairs, as shown in Figure 10) to certain wireless networks, only synchronizing when the power is plugged in, and whether files should be updated one-way or bi-directionally.

Figure 10. Configuration Options for Foldersync

Figure 11. FolderSync-Supported Protocols

But the great thing about FolderSync is all the different protocols it supports (a part of that selection list is shown in Figure 11). Have a file server at work that exports a Samba share? FolderSync will link up to that, no problem. Want to do some updates to a site on your Web server? Get WebDAV(S) running on Apache, and you're set. Oh, and remember all those cloud services we talked about? Dropbox, Box and Google Drive? FolderSync does that one, that one and that one too.

The "Lite" version will allow you to sync up with one other folder on one device, so if that's all you need, you can avoid having to pony up any cash. But the Pro version will allow you to set up your Android device as a central hub for anywhere you stash files. Now if only they started making devices with 1TB Flash drives....

Direct Connection

The last, and slightly old-school way, to connect your Android device to your Linux box is via a direct USB connection. While this may evoke feelings of nostalgia for longtime gadget geeks who remember popping a Palm into a cradle and hitting the "HotSync" button, I find this to be the worst experience on newer devices, for reasons I'll explain below.

The Gingerbread (2.3.6 and below) Way

On Android devices prior to v.3.0, Google did the "right thing" to enable access to the device's filesystem. When plugged in via a USB cable, the device appears to be just another USB drive. You could move files to and fro, access documents directly on the device, and basically treat the phone or tablet just as you would any other thumbdrive (with maybe the exception of leaving it in your pocket to go through the wash).

Like SSHDroid above, once this USB storage was mounted, you could use any Linux tool at your disposal (Unison, Krusader, rsync) to make sure they were up to date. All was well, until Google tried to be too smart for its own good.

The Honeycomb (3.0 and above) Way

From Android v3.0 and up, plugging a device in via USB no longer shows up as USB storage (that is, the "easy way"). Rather, you're required to choose in the devices settings whether, on USB connection, you'd like the device to use the MTP protocol (that is, to appear to the other machine as a media player) or the PTP protocol (that is, to appear as a camera).

Now, I've read that there's a technical reason for Google's decision to do this, mainly that all applications and data now can reside on a single filesystem (as opposed to having to choose, for example, to install apps on the "phone" or on the "SD card", as I do on my OG Droid). All I would argue is that, for this user, those benefits do not outweigh the terrible experience of trying to use MTP on Linux (PTP actually works quite well, but only gives you access to the "DCIM" folder, so unless you want to store all your other stuff alongside the pictures taken by the built-in camera, this won't do).

I spent the better part of a weekend combing through posts on the XDA forums (http://forum.xda-developers.com"), which is a fantastic resource for all sorts of Android hacks, trying to find a nice, automated method of mounting the Prime's SD card. I found a couple resources (http://www.omgubuntu.co.uk/2011/12/how-to-connect-your-android-ice-cream-sandwich-phone-to-ubuntu-for-file-access and http://forum.xda-developers.com/showthread.php?t=1143044), but eventually settled on the script and instructions provided via this YouTube video: http://www.youtube.com/watch?v=3ehnoJn6CEk). After all that, I sat down, ready to see the Prime as just another drive in /media, just like the old days.

Well, not only is MTP access on Linux inconvenient to use, it's interminably slow. Once I got connected, I started copying my music collection to the Prime and left it plugged in overnight to do so. When I got up the next morning, it was approximately 5% completed. Before you start asking for transfer rates and whatnot, I don't have them, but I was able to transfer about half that same collection within a couple hours, and over SFTP (so with en/decryption overhead) no less. So I've pretty much sworn off direct connection for the Prime...there are so many other ways to shuffle files and data around, who needs it?

Conclusion

One of the great things about Android is that the ecosystem is free to come up with a variety of solutions to a problem and let users sort out which one best fits their needs. It could be that no one of the above alone will suit you—I myself use both SSHDroid and FolderSync on almost a daily basis. But all of the above apps are either free, or have free trial versions, so there's nothing stopping you from testing them out. Give it a try, and the robot and penguin will be getting along famously in no time!