Maps Sans Play Services

One of the bigger reasons why developers depend upon Google Play Services is for MapsV2, the native Android mapping engine. Lots of developers are comfortable with just implementing MapsV2, on the grounds that most Android devices are part of the Google Play ecosystem and therefore can use MapsV2.

This, of course, makes manufacturers outside the Play ecosystem sad.

Some of those manufacturers have elected to provide their own mapping solution. Amazon, for example, offers maps with an API that is very similar to MapsV1 (the old API) and MapsV2. However, this still requires developers to code to these distinct APIs, perhaps employing product flavors in Android Studio and Gradle for Android to isolate the ecosystem-specific code bits. After all, Amazon’s maps only work on Amazon hardware, so you still need something that can work elsewhere.

One way to try to deal with this is to use a compatibility layer. Airbnb went down this road, and last week they released AirMapView based on their work.

AirMapView is designed to give you a map, regardless of the device that you are running on. It tries MapsV2 and falls back to maps powered by WebView and the Web edition of Google Maps. Airbnb indicates that support for Amazon’s mapping engine is forthcoming. I hope that somebody contributes an OpenStreetMap extension for it as well. And, they too offer an API that is close to MapsV2. If it works as advertised, you can get the best possible map for a given device, without constraining yourself to only devices that offer MapsV2.

The 1.1.2 AAR for AirMapView clocks in at ~100KB, so it will not grow your APK too much. AirMapView is definitely a project to keep track of, and to evaluate when it makes sense for your team. Having the ability to support non-Play devices may prove important to you in the long run. Anything you can do to isolate the Play-specific code and have options for replacing it would be good, all else being equal.