Hacking away with Android pt 1 – using the file system, WiFi and FTP

Posted on October 29, 2010

2


This is one in a series of more posts to come.

Brief

In the past days I have been testing several options with my Android Devices to see if I can move them beyond their general purpose. It is a preparation towards three types of use:

  1. Using Android Tablets as an alternative for a Netbook – including the use of an external keyboard, external storage, and an external mouse
  2. Using Android devices (like tablets, hand helds and phones) as distributed computers – each fulfilling a specific task and each capable of communicating to the others and sharing and transferring files
  3. Using a chain of Android Devices as the “Smart Part” of Roomware installations – allowing Arduino devices and XBee-based devices to become connected to an Application Pool that can extend the local setup to a global installation.

Related posts

Android – more than phones: moving into alternative uses of the Android phone

Hacking away with Android: A series of articles to discover the possibilities of the Android hardware and software for productivity, hardware hacking and cluster-computing

Recommended basic downloads

Download the following applications from the Android Market on your phone. They are your starting point. Each will be discussed later.

  1. APKinstaller – from, to load and launch .apk files
  2. SwiFTP – an FTP server for Android, to create direct access to your device / phone file system via FTP
  3. WiFi Static – to create a static IP in specific WiFi networks
  4. DavDrive – to make your phone available via webDAV – an alternative for the FTP solution. You might like this more than FTP.

Download the Android rooting software separately and run it on your phone

  1. Universal Androot

Recommended links

  1. How to wireless transfer files between Android and PC using SwiFTP – this post describes how to turn your Android device into a Virtual Drive

Used phones and devices

  1. The Samsung Galaxy i7500 | Android 1.5, upgraded to 1.6 – My old phone, upgraded and rooted (see links on the how-to, and read the comments, as the instructions are not complete)
  2. The LG G540 | Android 1.6 – My new phone, in the low-end price range of Android phones (about 200 euro) and rooted
  3. The Archos 7 Android Tablet | Android 1.6– While waiting on the newer models to hit the market, this one is nice to start with
  4. My MacBook Pro with Windows installed via VMware

Main issues that led to this article

I am testing the possibilities of the Archos line of Android tablets. I want to install applications that allow me to edit Office documents and add more value to the Tablet as a possible “Netbook” computer. I also have 2 other Android devices with which I am experimenting in different setups.

  1. I can not download Android Market files on my Archos – as it does not have the Market installed.
  2. I want to be able to make “distribution packages” – containing a collection of Andorid APKs to do specific things
  3. I want to be able to distribute these packages fast and simple – to multiple devices

My motives are somewhat nerdish. There is no clear purpose except for wanting to do this because “all other” methods (including connecting the phone via USB to the computer and using the Android SDK) are too much fuss or rendered to be “stupid”.

Discussed in this article

The following things have been investigated and will be discussed in this article:

  1. Rooting the Android device – Necessary for some things (like file access to the “data” folder from outside and Tethering) nice for others (browsing the root folders and copying APK files – the Android Executable files – to the SD card, enabling me to distribute them to my other devices)
  2. Using the device as an FTP Server – useful to transfer files to- and from the Android device, especially when working with multiple Android devices
  3. Fixing your IP number – Once you hook your device in the WiFi network and start communicating to it, it is nice to have a fixed IP number to refer to.
  4. Installing an FTP Client – useful to directly communicate to other Android Devices and move files from one to another
  5. Installing a Web Server – useful to run sites, or directly manipulate stuff on your Android device via a web interface when it allows you to run Java Beans
  6. Installing an WebDAV server – Similar to using the device as an FTP Server, with the added value that you can use your file-explorer to browse folders and transfer files between your computer and the device
  7. Testing several file browsers – to manage and transfer files on the local system
  8. Throwing stuff around between Android Devices – using a laptop, SD-cards and several Android Devices to share applications and files
  9. Launch applications after boot – Defining which applications will automatically be started when the Android device is booted

1: Rooting the Android device

Universal Androot

Rooting the Android device is simple for most Android phones. In my case I tested it for the Archos7 and the LG G540, using Universal Androot. The G540 roots beautifully. The Archos7 does not root at all, apparently due to a Archos-specific build of the Android OS.

More info about rooting can be found on an earlier post here.

Why rooting is relevant for this post:

  1. This post covers tablets and phones
  2. Not all devices have access to the Android Market – Tablets in particular are excluded, while the applications you like to distribute and share can – in most cases – only be downloaded via the Android Market.
  3. I want to distribute applications downloaded from the Android Market from one device to another – This is possible by using Root Explorer (see further below), your SD-card and an FTP Client / Server solution

2: Using the device as an FTP Server

SwiFTP

When you install an FTP server on your Android Device, you make the file system of that device accessible via WiFi. The benefits and uses are these:

  1. No USB connection needed for file transfer – You can directly access the Android device via FTP and transfer files to and from your machines via WiFi
  2. Upload files to your device – Like music, movies, applications and office files
  3. Download Android Market files from your device – if it is rooted and you use Root Explorer: your can find and copy your .apk files downloaded from the Google Market

I have looked at two applications that do the FTP-server trick, including:

  1. FTPServer by Andreas Liebig – gives a nice activity log, but does not allow my FTP client (Crysal FTP Pro) to do much
  2. SwiFTP by Dave Revellworks like a charm

3: Fixing your IP number

WiFi Static

When you make your IP number fixed, your device will connect via that IP number any time it connects to that specific WiFi network. The benefits are these:

  1. The IP address of your device remains unchanged – Even when you disconnect and reconnect, your device will be issued the same IP address
  2. Easy access via pre-defined connection settings – You can setup the connections to your Android Device using a fixed number.
  3. Easy access and communication between your devices – Once each of your devices has a fixed number, you can easily swap files between each other, or do more advanced stuff with Roomware or other real time systesm (more about that in a later post).

Where Android offers you to force a fixed IP-number in a WiFi network, this is for all networks. As you might be a guest in someone elses network, forcing your IP number also on their system, I find it more polite to do it on a network per network basis.

I found one application that does the trick: Wifi Static.

WiFi Static takes your current WiFi network and allows you to configure the IP-number you want to use for your device. This configuration is per network and automatically kicks in when your device connects to the WiFi.

4: Installing an FTP-client

andFTP

Once you have fixed your IP-number, using an FTP-client between your devices becomes an interesting option. In my case I tested this using an Archos7 tablet and a Android phone, where the phone is rooted and the tablet is running in normal mode.

Using the FTP-client and the fixed IP-address, connecting to the phone is done by selecting it from the profile.

As I have Root-access to the phone, I can copy the files I downloaded, put them on a place sharable to other machines and transfer them via FTP on my Archos7 SD card.

FTP clients tested:

  1. FtpCafe (1.99 pound for full version) by Dragan Andric – a good looking FTP client, using one tab for local and one tab for remote folders
  2. AndFTP ($3.99 for full version) by LyseSoft – a more straight forward FTP client, following the same design patterns as FtpCafe

5: Installing a Web Server

Paw Server

The limited capacities of your Android device (memory, performance, storage) does not make it into a suitable web server to run your websites from. But when you are hacking the Android, installing a Web Server on your Android Device suddenly starts to make sense for the following reasons:

  1. Access to functionalities on the phone – Anything running on the phone can be made accessible (in theory) via a web interface. Including:
    1. Influencing Device settings – like switching bluetooth on and off
    2. Starting and killing applications (not tested yet) – to perform specific actions and clear the memory
    3. Reading status logs from the device – like the status of the hardware, events happened (doors opened and closed) and so on
    4. Manipulating connected hardware – like Arduino and XBee devices and other hardware you have (written) controllers for
  2. Exposing remote controls – like “open door / close door” or showing specific data on specific screens (think shops here, where you can see what they sell, using your phone and the browser on your phone to run through their catalog)

I found the following Webservers capable of running applets:

  1. I-Jetty – “A port of the popular Jetty open-source web container to run on the Android mobile device platform.” – very hard to make work with your own stuff.
  2. PAW Server by Fun2Code – A full blown web-server using BeanShell that allows you to run your own Java beans and is automatically started when your Android device is started

I have not tested these two web servers yet, so no experiences available yet on what you can do with them and your Android device.

My current preference goes to PAW Server, for the use of BeanShell, which seems to offer a very simple and straight forward way to run your Java Apps on the background.

6: Installing a WebDAV server

Dav Drive

WebDAV is supported by both Windows and Mac OS. It allows you to open a direct File-browser based channel to your Android Device and with that the possibility to open multiple sessions to multiple devices and drag and drop files from one to the other.

I found and tested the following applications:

  1. WebSharing by NextApp – A paid application (US$ 2.99) if you want to use WebDAV
  2. DavDrive by Fun2Code – A free application offering you enough configuration options to do what you need

Automated start of WebDAV sharing not possible (yet) – Sharing via DAV needs to be started manually for both applications, once they are running, making automatic startup and availability of WebDAV access to your devices not possible yet. This might also be something I overlooked.

[Update]

The commercial version of DavDrive does allow for auto-start

7: Testing several File Browsers

Root Explorer

There are several tastes in File Browsers for Android. I looked at the following properties:

  1. Easy drag and drop
  2. Root
  3. Easy file manipulation
  4. Easy to share over- / working on multiple devices (as the Archos does not allow access to the Android Market without hacking)

Scali Commander

With the sharing as the main filter, the following two applications have been tested:

  1. Root Explorer by Speed Software (2.50 pound)- Allows multiple-file select, very effective for moving and copying files from one to another folder. Can be moved to other devices
  2. ScaliCommander by Gnslngr (0.99 euro) – Offers a 2 pane list, one with the “source” items and one with the “destination” items. Does not work with Root.

Others like File Expert (nice looking, FTP upload options, does not use the possibilities of Rooting), ES File Explorer (does not use the possibilities of Rooting) and the Japanese “Super Manager” does not use the possibilities of Rooting) have not been tested yet.

8: Throwing stuff around between Android devices

At this point in time, I have only looked at manual file transfers. Automated transfers and synchronizations are not tested yet.

To make file transfer easy between your Android Devices (taken that they live in the same WiFi network, the following steps are to be taken:

  1. Fix the IP-address of your Android device within your local WiFi (WiFi Static does that job for you)
  2. Install and run a FTP Server (SwiFTP does the job very well)
  3. Install and run an FTP client (AndFTP is currently used by me,  File Expert might be another option)
  4. Define the Android FTP-servers you want to communicate to – using the fixed IP-addresses of each device to be able to connect again the next time
  5. Run a File Browser with Root Access (Root Explorer does a good job) if you want to also transfer files from the “/data” folder from your phone
  6. Share the files from your device on your SD card

I currently use either a PC or the Archos7 and Archos 32 (acting as a USB host and with mouse and keyboard connected) for the more extensive actions.

9: Launch applications after boot

I found one application doing the trick:

  1. LaunchAfterBoot by Androgene Development (see the English description here)

It allows you to select the applications you want to launch after booting. These could be:

  1. Your Android FTP Servers – allowing you and others to access the FTP server and your file system.
  2. Your Android Web Servers, if you do not choose the PAW Server
  3. Your Roomware Server (if you develop Roomware stuff)

Conclusion

This post hopefully gave you some insight in the options you have with the Android Devices (including phones and tablets) to go beyond the basic: “watch a movie, browse a website, listen to some music” type of use.

Later posts

In later posts I will go into specific uses and show you how to use the Archos7 tablet as a “Netbook”, by connecting a keyboard and mouse via a USB hub and running a simple Office Suite allowing you to create, open and edit Word and Excel files on your Android device.

I will also release a new Android Roomware Client / Server in due time allowing you to share sensor data (including those from your phone) between devices within your WiFi network.