Everything has a location, whether it
be the photos you took, where you
are, the places you like to hang out,
where you bought that special gift,
or even the last place you met your date.
I'm Megan Boundey Product Manager
for the Google Maps Mobile SDKs.
Today I'm going to show you some cool ways
to use Google Maps Mobile SDKs, to help you both bring
these experiences alive, and delight and engage your users.
In this session, I'm focusing on the Google Maps Android API v2.
But all of this functionality is available in the Google Maps
SDK for iOS as well.
This is great if you're looking for cross-platform consistency
for your apps.
When developers think of having a map in their app,
they often think of something like this, a marker on a map.
This is great for showing you a location
or marking out where you might want to meet someone.
But did you know that you could add Street View to your app
like this?
Or make cool apps, like Santa Tracker,
that follow Santa around the world as he delivers presents?
Let's take a look.
Our docs show you how to embed a Google Map in an Android
activity.
Then it's easy to add markers to your map.
You just use the addMarker method
and specify a few options to customize the Marker.
For example, you can set latitude and longitude,
change the color of the Marker.
You can also set what shows up in the Info Window
when the user taps the Marker and the Info Window pops up.
You may even want to use photos as your Marker.
Maybe you want to show where the photo was taken on a map
and associate it with an event, rather than just
showing a strip of photos in your app.
Now that you've seen Markers, let's
take a look at Street View.
Most excitingly, you can add Street View imagery
to your apps.
In this demo, you can see the split screen
with the Street View imagery in the top half,
and the Google Map in the bottom half.
By long pressing the Marker and dragging,
Street View imagery updates, and shows
you the location where you dragged the Marker to.
So how do you do this?
A very similar demo is available in the demo examples
in the Google Maps for Android API v2 itself.
So the code is all there.
Here we've split the layout into two parts.
There's one fragment for the Street View panorama,
and one fragment for the Google Map.
You then set the same initial location
for the map, the Marker, and the panorama.
And we've given our Marker a custom icon, which is Pegman.
When you drag the Marker, you listen to a drag event
from the Marker and use the callback
to position the location of the panorama.
When the panorama change event occurs,
the listener will give you the precise location
of the panorama, and you can feed this back to the Marker
to update its position completely accurately.
So what else can you do with Street View?
You may want to add Street View to your Store Locator,
see an area around a hotel, or view a museum or an aquarium.
Street View also provides you with seamless access
to Google's Indoor Street View imagery.
You can set the Street View panorama
to be of imagery within the aquarium,
or set it outside the aquarium, and have your users navigate
inside if they wish.
Of course, you can do this for stores
as well, if the store has indoor business view imagery.
This would be awesome if you're a store owner
and you want your customers to see what's available
inside to entice them to come and visit you.
Moving on.
How can you make your users feel more
immersed in their Maps experience?
Have you tried out the Santa Tracker app
and wondered why it felt so movie-like to follow Santa
as he flies around the world?
This is because we made the camera track Santa's location.
Both the Google Maps Mobile SDKs use a camera
that lets you set the location of what you want to look at.
You can animate the camera by using a camera update
and calling the animateCamera method.
This is where you can also set the zoom level, the bearing,
the tilt, and the duration of the animation.
It's so effective.
If you don't want to see any animation,
you just call the moveCamera method instead,
and it will move the map directly to that new location.
We have a whole session dedicated to the Santa Tracker
app at Google I/O 2014.
So make sure to take a look.
Now you know how to make your users
feel more immersed in their Maps experience,
how do you add things to the map and animate them?
For example, how do those weather apps
get their clouds coming in over the terrain map?
Google Maps has several map types available,
such as satellite, hybrid, or terrain.
It's really easy to switch between map types.
You just use the setMapType method on the map
and specify the map type that you want.
These apps are also using mostly transparent tile overlays
with the clouds as the opaque features.
Tile overlays allow you to specify particular tiles
to be shown at a given set of coordinates.
You should also specify which tiles
can be shown at each zoom level.
All you need to do is to find a urlTileProvider
and supply that to the TileOverlay options.
Then add it to the map.
To make their clouds appear to be moving,
the weather apps are swapping out
multiple tile overlays periodically
to make it appear animated.
Talking about the weather, it may be time to go inside.
There's also the ability to see indoor maps along
with with [? perkomatic ?] control of the indoor level
of a building and the floor picker.
You can find out which building is
active by calling getFocusedBuilding,
and then find out the active level of that building
by calling getActiveLevelIndex.
This is great if you want to show
Custom Markup for the Active Level,
such as markers, poly lines, tile
overlays, and other shapes.
You can also turn off our default Level Picker
and implement your own by passing false to the method
setIndoorLevelPickerEnabled and then adding your own.
Now we've seen all parts of the world via our map-- indoor,
outdoor, Street View, a normal [INAUDIBLE] map,
and weather overlays.
Who knew you could so much with Maps in your apps?
To get started mapping up your own apps, go here for Android
and here for iOS.
And if you need any help, our Support Page
lists the stackover Play tags that you need.
So what are you waiting for?
It's time to get out there and start mapping up your apps.