Google Maps API
Brief introduction
Maksim Golivkin
www.androidaalto.org
www.mobileguild.eu
Twitter: MaksimGolivkin
13.11.2...
Plan
13.11.2010 Android Aalto Community
Intro to Google Maps API
MapView & MapActivity
Overlays
Distances
Balloons
Geocodi...
Intro to maps API: New Project
13.11.2010 Android Aalto Community
Target build and emulator have to use Google API for
pla...
Intro to maps API : AndroidManifest.xml
13.11.2010 Android Aalto Community
Things to remember:
uses-library declaration fo...
MapView: Layout
13.11.2010 Android Aalto Community
If inappropriate API key is used, map isn't displayed.
For one Google a...
MapActivity onCreate
13.11.2010 Android Aalto Community
Overlays
13.11.2010 Android Aalto Community
Each overlay is information layer on the map.
Google Maps has 3 overlay classe...
Overlays: hierarchy
13.11.2010 Android Aalto Community
Overlays: ItemizedOverlay #1
13.11.2010 Android Aalto Community
Most important thing:
on every content change call protect...
Overlays: ItemizedOverlay #2
13.11.2010 Android Aalto Community
Overlays: ItemizedOverlay usage
13.11.2010 Android Aalto Community
Overlays: MyLocationOverlay
13.11.2010 Android Aalto Community
Convenient to display user location on map.
Most important ...
Overlays: MyLocationOverlay usage
13.11.2010 Android Aalto Community
Distance
13.11.2010 Android Aalto Community
Note:
Google Maps API uses (int) micro-degrees for
coordinates;
Android Locati...
Distance calculation
13.11.2010 Android Aalto Community
Balloons : usage
13.11.2010 Android Aalto Community
Balloons
13.11.2010 Android Aalto Community
Nice small existing library.
Available at:
https://github.com/jgilfelt/android...
Geocoding
13.11.2010 Android Aalto Community
Geocoding - translating coordinates to address.
Reverse geocoding - translati...
UI update with Handler
13.11.2010 Android Aalto Community
Nested anonymous classes are ugly!
Alternative: Handler + Messag...
Thank you!
13.11.2010 Android Aalto Community
Example code can be found at:
http://mobileguild.eu/code/FindHackatron.zip
Upcoming SlideShare
Loading in...5
×

Google Maps API for Android

16,706

Published on

Presenting use of Maps, distance calculation, geolocation.

Code examples.

Published in: Technology
0 Comments
8 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
16,706
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
447
Comments
0
Likes
8
Embeds 0
No embeds

No notes for slide

Google Maps API for Android

  1. 1. Google Maps API Brief introduction Maksim Golivkin www.androidaalto.org www.mobileguild.eu Twitter: MaksimGolivkin 13.11.2010 Android Aalto Community
  2. 2. Plan 13.11.2010 Android Aalto Community Intro to Google Maps API MapView & MapActivity Overlays Distances Balloons Geocoding UI update with handlers
  3. 3. Intro to maps API: New Project 13.11.2010 Android Aalto Community Target build and emulator have to use Google API for platform you have chosen. For instance, Google API for 1.6
  4. 4. Intro to maps API : AndroidManifest.xml 13.11.2010 Android Aalto Community Things to remember: uses-library declaration for runtime; permissions to access Internet and location services.
  5. 5. MapView: Layout 13.11.2010 Android Aalto Community If inappropriate API key is used, map isn't displayed. For one Google account one can generate several keys. How to generate your own: http://code.google.com/android/add-ons/google-apis/mapkey.html
  6. 6. MapActivity onCreate 13.11.2010 Android Aalto Community
  7. 7. Overlays 13.11.2010 Android Aalto Community Each overlay is information layer on the map. Google Maps has 3 overlay classes (main purpose below): Overlay - drawing complex figures on the map and capturing touch moves. ItemizedOverlay - abstract, extends Overlay, for drawing of multiple markers. MyLocationOverlay - to display user location on the map.
  8. 8. Overlays: hierarchy 13.11.2010 Android Aalto Community
  9. 9. Overlays: ItemizedOverlay #1 13.11.2010 Android Aalto Community Most important thing: on every content change call protected populate method; include populate call in constructor Reference: http://code.google.com/p/android/issues/detail?id=2035
  10. 10. Overlays: ItemizedOverlay #2 13.11.2010 Android Aalto Community
  11. 11. Overlays: ItemizedOverlay usage 13.11.2010 Android Aalto Community
  12. 12. Overlays: MyLocationOverlay 13.11.2010 Android Aalto Community Convenient to display user location on map. Most important thing: call disableMyLocation and disableCompass (if enabled), when activity goes to background.
  13. 13. Overlays: MyLocationOverlay usage 13.11.2010 Android Aalto Community
  14. 14. Distance 13.11.2010 Android Aalto Community Note: Google Maps API uses (int) micro-degrees for coordinates; Android Location package uses (double) degrees for coordinates; microdegrees = degrees * 1000 000; or microdegrees = degress * 1E6; degrees = microdegrees / (double)1E6;
  15. 15. Distance calculation 13.11.2010 Android Aalto Community
  16. 16. Balloons : usage 13.11.2010 Android Aalto Community
  17. 17. Balloons 13.11.2010 Android Aalto Community Nice small existing library. Available at: https://github.com/jgilfelt/android- mapviewballoons
  18. 18. Geocoding 13.11.2010 Android Aalto Community Geocoding - translating coordinates to address. Reverse geocoding - translating address from coordinates. GeoCoder class. Do geocoding in background thread!
  19. 19. UI update with Handler 13.11.2010 Android Aalto Community Nested anonymous classes are ugly! Alternative: Handler + Message + Bundle. Note: when updating UI, be sure to instantiate Handler (or Handler child class) in UI thread. For example, in onCreate method.
  20. 20. Thank you! 13.11.2010 Android Aalto Community Example code can be found at: http://mobileguild.eu/code/FindHackatron.zip
  1. ¿Le ha llamado la atención una diapositiva en particular?

    Recortar diapositivas es una manera útil de recopilar información importante para consultarla más tarde.

×