Cyril Mottier

“It’s the little details that are vital. Little things make big things happen.” – John Wooden

The Google Maps Android API V2 Utopia

One of the major announcement this week was the release, by Google, of a new maps framework: the Google Maps Android API v2. It is nothing to say that this new framework was overwhelmingly expected among the Android developer and user communities. Indeed, while the Google Maps app was using vector-based maps and 3D rendering since its version 5.0 (working on Froyo+), these features weren’t available to third-party applications. The only option at this time was to continue leveraging (yep that’s not a joke) the long-outdated Google Maps Android API v1…

As the creator and developer of Polaris - a library greatly enhancing the features of Google Maps API v1 with effortless map annotating, gesture support, map callout support, built-in “user tracking” mode, etc. - and the developer of AVélov - a map-based application to determine the availability of city bikes/slots in Lyon, France - I really wanted to have a look at the new version of the framework. So did I and here is a feedback after 5 days playing with it.

At first sight, Google Maps Android API v2 is clearly an insanely great improvement to the first version of the framework. First of all, it is providing the developer with all of the features I developed on top of Google Maps Android API v1 with Polaris: it gets rid of the annoying ItemizedOverlay, it provides a “user-tracking” mode, it recognizes all gestures, it contains several default resources (markers, info windows), etc. Moreover, all of this is based on a new vector-based rendering engine supporting scrolling, zooming, tilting and bearing for continous levels. Thanks to that you can now have a non-discrete zoom-level of 6.1234 which basically means you can create awesome smooth animations.

In addition, the framework brings some cool new features such as support for third-party tile provider, ground overlays, polylines, polygones, etc.

Pretty logically, the engineers behing the framework threw away the API from v1 and re-wrote the v2 from scratch. I’m pretty happy with that because the new API are more Android-compliant and future proof. API v2 are finally in accordance with what we could expect from a company like Google that is supposed to excel at doing maps.

One of the major drawback though is that everything is final. In other words, they decided to put some concrete in the set of API to prevent developers from using them :s. While I understand the final keyword can be useful sometimes, I really don’t understand why they used it as proficiently and - as it looks to me - as stupidly. I’m strongly convinced developing a solid but yet extensible framework is possible - the Android SDK is a great example of it - and that’s not the approach Google took here.

Finally, there are some strong lacks such as the un-ability to be notified of user location change when using the default LocationSource or to be notified precisely of a CameraPosition change.

Okay so now we are done with the API, I will continue with the implementation. In order to efficiently test the new Google Maps API v2 framework, I decided to make the switch in AVélov. Put simply, the app consists on displaying a map with a bunch of markers. When you click on it you have an info window that pops out and shows the name/address of the station and starts an asynchronous request to query the current number of bikes/slots for this station. Once the query is done, the popup is updated with the availabilty data.

Let’s be honest this application is pretty simple. Well I guess it was too simple because I ended up with a lot of bugs and limitations. Indeed, while it bring some amazingly great improvements, it cruely lacks of polish and pixel-perfect-ness. This article is not intended to be a bug-tracker but here are the main issues I had/have:

  • Issue #4639: Black screen when instantiating a SupportMapFragment
  • Issue #4645: Info windows are not refreshed when updated
  • Issue #4666: Info window displayed in two parts with a 1px wide transparent gap
  • Issue #4667: Blurry markers

In a nutshell, I really consider this new Google Maps Android API v2 as a beta version. I spent a lot of time and energy working with it and finally realized I had done all of this for nothing. I am now waiting for all of these bugs to be fixed. From my point of view, I seriously consider this new Google Maps Android API v2 shouldn’t have been released at all or alternatively, should have been released as the Google Maps Android API v2 beta. It clearly doesn’t respect my motto: Do less but do it great.

I spent the last 5 days being both joyful and unbelievably mad at the same time. I couldn’t resign myself publishing a version of my app which quality was lower than the current available version. While Google Maps API v2 brings several major improvements, it also carries a lot of issues, bugs and limitations. Always keep that in mind when starting using it or you’ll end up as disappointed as I was.