Join David Gassner for an in-depth discussion in this video Adding map markers, part of Building Mobile Apps with Google Maps Android API v2.
Google Maps uses something called a…marker to visually indicate a particular location.…In the Browser version of Google Maps, if you type…in a locality, such as a city or a landmark.…You'll relocate the map and a marker will be placed automatically.…I'll type in New York and press Enter.…And that takes me to New York, and adds the marker.…Or, if I type in a particular landmark…such as Statue of Liberty, the map will relocate,…resize itself, and add a marker showing that monument.…
You can replicate a lot of this functionality in your…Android app, and I'll show you some of the basics.…I'm working in a version of the project called AddMarkers.…I've cleaned up some of the code in this version, including…suppressing some of the toast messages I was using for debugging earlier.…And in the geoLocate method, I've moved the code around…a little bit, to do a little bit better error handling.…For example I am making sure I don't try to geoLocate it in…empty string, but now I would like to improve this method even further.…
Note: An Android device with Android 3.0 (Honeycomb) or higher, and that has Google Play Store installed, is required to use the course exercises. (Kindle Fire and Nook devices do not qualify.) Finished mapping apps can be deployed on Android 2.2 (Froyo) or later.
- Setting up the developer tools
- Adding required permissions
- Getting a Google Maps API key
- Importing and linking the Google Play services
- Setting a map's initial state
- Geocoding an address
- Getting the current location programmatically
- Adding map markers
- Handling marker events
- Drawing lines, polygons, and circles
- Adding maps to existing apps
Skill Level Intermediate
Q: In the Chapter 2 movie "Checking the device for the Google Play services APK," when I create my first Google Maps app, the app crashes when I call the custom method servicesOK(). The error in LogCat starts with: "java.lang.IllegalStateException: The meta-data tag in your app's AndroidManifest.xml does not have the right value." How do I fix this?