SUMMARY
This chapter took a whirlwind tour of the MapView object, which displays Google Maps in your Android application. You have learned the various ways in which the map can be manipulated, and you have also learned how you can obtain geographical location data using the various network providers: GPS, Cellular triangulation, or Wi-Fi triangulation.
EXERCISES
1. If you have embedded the Google Maps API into your Android application but it does not show the map when the application is loaded, what could be the likely reasons?
2. What is the difference between geocoding and reverse geocoding?
3. Name the two location providers that you can use to obtain your location data.
4. What is the method for monitoring a location?
Answers to the Exercises can be found in Appendix C.
WHAT YOU LEARNED IN THIS CHAPTER
| TOPIC | KEY CONCEPTS |
| Displaying the MapView |
<com.google.android.maps.MapView android:id="@+id/mapView" android:layout_width="fill_parent" android:layout_height="fill_parent" android:enabled="true" android:clickable="true" android:apiKey="<your_key_here>" /> |
| Referencing the Map library |
<uses-library android:name="com.google.android.maps" /> |
| Displaying the zoom controls |
mapView.setBuiltInZoomControls(true);
|
| Programmatically zooming in or out of the map |
mc.zoomIn(); mc.zoomOut(); |
| Changing views |
mapView.setSatellite(true); mapView.setTraffic(true); |
| Animating to a particular location |
mc = mapView.getController(); String coordinates[] = {"1.352566007" ... |
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access