Monday, 18 July 2011

Announcing Baitha: The Scala/Android toolkit

Over the past month or so, I have started developing an Android application for a client. Perhaps one of the most interesting aspects of developing this application is that it is being created in Scala and C++. In addition to being a great opportunity to do some larger-scale development for Android and with Scala, it has given me the opportunity to start developing a toolkit for Scala and Android developers.

Baitha is hosted on GitHub and is licensed using the Apache Software License 2.0. I hope it may be useful to other Scala/Android developers, and I would love feedback from developers in terms of comments, patches, etc. The library is currently designed to be used an Android library project and can easily be integrated using a snapshot version of the SBT Android plugin. For more information, please consult the readme.

Right now, the library supports the following features:

  • AlertDialogBuilder: A wrapper around Android’s AlertDialog.Builder class that provides some implicit conversions and a mini-DSL.
  • BuildMode: A trait that makes converting between debug/production code easier.
  • EnhancedViews: Provides some implicit conversions to make adding listeners as functions.
  • Logger: A replacement logging interface inspired by RoboGuice.
  • SdkVersions: Offers conditional execution depending on the runtime version of the Android platform.

Please check it out, use it, and help improve it.

Thursday, 19 May 2011

The Motorola Xoom and the Asus Eee Pad Transformer: a developer’s perspective

I have been getting more deeply involved in Android development of late, and these days that means developing for both phones and tablets. Unfortunately, the emulator for Honeycomb is incredibly slow. Therefore, I decided to purchase the Wi-Fi version of the Motorola Xoom shortly after it was released.

Just a month later, I learnt about the Asus Eee Pad Transformer and its well-integrated keyboard dock. Seeing the opportunity to have a device that can be used as a netbook, I decided to get one of these as well.

Now that I have had the chance to use both of these devices, I thought I would take the time to write about both of them primarily from the standpoint of a developer.

The Motorola Xoom

The Motorola Xoom was the first Honeycomb tablet, and Google used it as their development device. It was initially released as a 3G model for Verizon, and later as a less expensive Wi-Fi only model. Both versions have 32GB of built-in memory, and a non-functioning microSDHC card slot. Overall, it is a well-built and solid tablet.

Developing with the Xoom

Developing applications with the Xoom is a fairly standard experience. Simply connect the tablet to your computer via USB, just as you would with most any other Android device.

However, if you want to work at a lower level, the Xoom’s bootloader can easily be flashed just like a Nexus device. Unfortunately, it seems like the full source code for Honeycomb will not be released, at least not until it’s released as Ice Cream Sandwich.

On the cutting edge

One thing that makes the Xoom particularly interesting to developers is that it appears to be the primary tablet used for development at Google. As a result, it is the first to get operating system updates. Android 3.1 was announced at Google I/O, and within days both versions of the tablet started getting OTA updates to this latest Android release.

Not quite complete

Unfortunately, despite its expense, it is not quite complete. It has now been three months since the initial release of the Xoom, and the software to make the microSDHC card slot is still vapour-ware. This is particularly embarrassing since other tablets have now shipped with working slots.

Similarly, for the 3G version, the upgrade to LTE will require mailing the device to Motorola and waiting at least a week for it to be returned. For a user, this is very annoying; for a developer, this is potentially downtime.

The Asus Eee Pad Transformer

The Transformer was released in the US late last month. In many ways, it is a typical Android tablet: 10.1 inch 1280×800 pixel display, 1GB RAM, and a 1.0GHz dual core Tegra 2 processor. It is currently on Wi-Fi only, and available in both 16GB and 32GB configurations. It also has a working microSDHC card slot.

However, what really sets the Transformer apart is this keyboard dock. Slipping your tablet into the dock transforms your tablet into a nice Honeycomb netbook. In addition to the full keyboard, the dock also adds a full size SDHC/MMC card reader, two full-size USB host mode ports, and a battery that combines with the tablet’s battery to provide upwards of 14 hours’ worth of power.

Developing with the Transformer

Like the Xoom, you can just plug the Transformer into your computer’s USB slot, and you are ready to develop. However, the Transformer has a couple of differences that make it less developer-friendly.

The tablet (and dock) use a proprietary socket that handles charging the battery, connecting to the dock, and connecting to a computer. The most important implication of this is that you cannot charge your tablet at the same time you do development. To make matters worse, the cable included with the tablet is quite short.

In practice, the battery life of the tablet is fairly good. Using the dock should give enough battery life to handle any marathon coding session, but if you forget to recharge your batteries you may end up having to disconnect from the computer in order to charge the tablet. I have not investigated if the dock’s USB ports can be used for an adb session.

Additionally, the Transformer does not have an unlocked bootloader. This makes it much more difficult to root the device or to do any low-level development. It is too bad Asus has chosen not to make the device more hackable.

Keeping up to date

According to Asus, Android 3.1 will not be released for the Transformer until sometime in June. While this may not be as speedy as some may like, it is roughly in line with other non-Xoom tablets.

One way in which I believe Asus has been better than Motorola is in releasing updates to fix problems experienced by users. Some engineers from Asus apparently hang out in the XDA developer forums, and have worked with users to solve various software problems. The result has been a series of updates since the product’s launch.

Beyond the tablet experience

The one thing that struck me while using the Xoom is that a tablet makes a splendid consumption device. It is good for surfing the web, watching a video, or playing a game. However, as a production device, such as writing e-mail or taking notes, it could not replace my laptop. It is true that the large screen makes typing on the tablet much better than trying to do the same on a phone, but it still cannot match the productivity of having a full keyboard.

The Transformer promises to change all of that. The keyboard dock will allow me to replace my laptop for many lighter tasks, such as checking e-mail, writing, and even some system administration and programming. I am currently working on modifying [ConnectBot][cbot], the popular Android SSH client, to work with the Asus keyboard (and other full keyboards via USB and bluetooth). This will help make the tablet not just a platform for development, but a useful tool in its own right.

Choosing a tablet

The Xoom and the Transformer are not the only options for an Android tablet. However, at the moment, I think these two tablets are the most compelling for the Android developer. Which should you choose? That all depends on your needs.

Choose the Xoom, if you…
  • Want to be running the latest Android release
  • Need to easily root your device or modify the firmware
  • Do not mind paying a premium. The Wi-Fi version retails at $600, $100 more than the equivalent Transformer.
Choose the Transformer, if you…
  • Want the best value in an Android tablet. At $400 for the 16GB version, it is the least expensive Honeycomb tablet on the market.
  • Would like to get more out of your tablet. You can spend the same amount of money and get a better netbook. However, if you are going to get an Android tablet for development anyway, spending the extra $150 for the dock may change how you use your tablet.