Android: An Exercise in Ship It
By Alex Davis
The magic of Airbnb becomes real when you’re actually climbing into your treehouse or docking at your own private island. You’re not in front of a computer; you’re participating in the locality in which you are immersed. In the course of this adventure, you might be contacting your host or guest, getting directions to the nearest sights, or giving tips on how to get to the coolest secret bistro nearby. And you’re probably doing it on your mobile device.
Airbnb exists in over 192 countries and 35,000 cities worldwide. As such, Airbnb builds products to meet the needs of our mobile and international audience. It’s no secret that our iPhone app rocks, but what about Android? You may have noticed that the (previous) version of our Airbnb Android app hadn’t received much love lately. Being that Android is actually the more internationally popular OS, we decided that this was unacceptable. We’ve now made a commitment to bringing a refined Airbnb experience to Android.
We started building the in-house Android team just a couple months ago. In a few short weeks we overhauled the look and feel of app: in addition to a slew of new features, we gave it an interface and style that feels much more consistent with the strong design culture of Airbnb.
The Old App
The New App — Android 2.0
Faster, cleaner, and more functional
For the Android Crowd
We had a hard deadline to launch the new Google Wallet integration features: May 15th at Google I/O convention. We decided we couldn’t simply throw away all of the existing implementation, and concluded that the best course of action was to turn the old app into a library project which was then included in the new code. In addition we used Android’s styles framework to tune the look and feel of the old content to our raised expectations.
In the process of re-architecting the codebase we found instances in which we needed to reference newly implemented classes from the existing code. This proved frustrating because we wanted to keep the division between projects as clean as possible. In order to launch a “new” activity from the code in the included library project, we used reflection to let the app compile:
Normally, in this situation, we would have a compiled reference to PropertyDetailsActivity.class, but since it only exists in the main project, we have to dynamically load the class at runtime.
Another issue that we encountered was the need to update the way we handle internationalization practices. In fact, we discovered possibly one of the more hilarious i18n one-liners we have ever seen:
- Interpolation of the night count with the “night” text in the phrase; no attempt at accounting for the fact that the “3-night” modifier might be different in other languages
- Same thing with guest count, only there is a really great attempt at pluralization:
- If guest count is > 1, “s” is appended to the word “guest”. We feel that this might be a common sin in internationalization; you need to actually use your android pluralization framework. The folks who build Android have put a lot of thought behind this.
- The date formatter is unlocalized; other locales do not necessarily use yyyy-MM-dd.
- Prepending a dollar sign to the price number to express price is wrong.
Speaking of internationalization, we found it much more convenient to have strings be located in a single file, and have things such as plurals referenced there. So, for example, instead of the following:
This flattens the format of what actually needs to be translated to make internationalization much easier on internal tooling.
The Journey Continues
What made this process unique was the aggressive timeline in which we needed to redesign and add to a full-featured app. However, we also wanted to have a clean break from the original contractor-implemented app.
Looking to the future, we intend to solidify Airbnb’s Android experience as a first-class citizen. Working closely with our incredible design team, engineering at Airbnb has the opportunity to solve formidable technical challenges to create one of the most elegant and compelling experiences in the world, for the whole world.
Give the app a look here!
Check out all of our open source projects over at airbnb.io and follow us on Twitter: @AirbnbEng + @AirbnbData
Originally published at nerds.airbnb.com on March 29, 2013.