Join David Gassner for an in-depth discussion in this video Maintaining map state between activity restarts, part of Building Mobile Apps with Google Maps Android API v2.
One of the things you might find as you work…with Google Maps and Android is that there are inconsistencies in…how the state of a map is saved and restored…when different changes are made to the application at run time.…Here are some examples.…In this version of my project which I've named Map State, I've…removed any code that might set the initial state of the map.…And so is the application starts up, it defaults to the…default location.…The intersection of the equator and the prime meridian.…Now I'm going to do some entry directly on the device.…
I'll go in to the edit text. And I'll type London.…And I'll touch Go. And that takes me to the London map.…Then I'll rotate, I'll zoom in a bit. And I'll change the map type to satellite.…So far so good.…Now let's see what happens in a few different…conditions when I destroy and restore the current activity.…First I'll touch the device's Home button.…That takes me back to the home screen.…
Then I'll touch the application icon, and I go back,…and the map is fully restored, including all of its settings.…
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?