Google Play Services 2.0 Adds Maps and Photo Sphere API
Google has released version 2.0 of their Play Services for Android applications. The new additions represent the Maps and Photo Sphere APIs, and are available for all applications running on Android 2.2+.
The Maps API enables developers to integrate almost the entire Google Maps for Android functionality into their mobile applications, including connecting to the Google Maps Service, downloading and displaying tiles, pan and zoom controls and gestures, with two exceptions: map tiles do not contain personalized content such as personalized smart icons and not all icons on the map are clickable.
The new API introduces support for map fragments which is a subclass of Android Fragment, representing a behavior or a portion of the UI in an activity. One can combine multiple map fragments to create a multi-pane UI or reuse a fragment in multiple activities. Adding a fragment to an activity can be done in XML or in code, the former being shown below:
The other API made available is Photo Sphere also called panorama. This kind of 360o pictures was recently introduced in Android 4.2, resembling Street View images available in Maps, and it comes with an open format, according to a Google post:
We’ve made Photo Sphere an open format so anyone can create and view them on the web or on mobile devices.
A Photo sphere is simply an image file (like a JPG) that has in it text-based metadata, an open format created by Adobe called XMP. The metadata describes the Photo Sphere’s dimensions and how it should be rendered within the interactive Photo Sphere viewer you see in Android, Google+, and Google Maps.
But perhaps one of the most useful features of Play Services is being supported for Android 2.2+ and their upgrade is done via Play store. Tim Bray explains:
The world hasn’t figured out how big a deal Play services is; one of the highest-impact changes in Android’s history.
Historically, big new features in Android required Framework revisions, which require major releases with updates right down into the Linux kernel, which only ship twice a year, and which aren’t reliably made available on older devices.
Play services allows the Android group to ship major new features (OAuth 2.0, Mapping, and Photo Sphere so far) in a way that is auto-refreshed on all compatible devices back to 2.2 “Froyo”. That’s a lot of devices. That’s a lot higher impact than all the new magic that rolls out any one major OS upgrade.