Google Maps in Android


Published on

Slides from the workshop presentation at Mobile 2.0 Europe Developer Conference 2010 on "Google Maps in Android" by Israel Ferrer from

Published in: Technology
1 Comment
  • I need Google maps GUI design code.plz help me
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Total Views
On Slideshare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Just for your information please use this hashtags for tweets about this session and for complaing, willings, questions that’s my twitter account
  • Good Morning everyone. Thanks for coming to this session. I am Israel Ferrer founder of bubiloop, the social network for apps recommendation, and, the biggest android community in Spain. I've been learning android for two years and nowadays I am working full time in bubiloop and this is some work I made and some parties.
  • First of all, I want to ask you some questions. ¿How many people in this room has and android phone?¿How many of this have a cool new android phone like nexus one or similar? P: Wow incredible, I am impress. N: cool, not bad. You have to improve that! Everyone that has this cool nexus one should know the power handset full of services out of the box. Nowadays this location-based apps are popular because smart phones like Android ones come with GPS, WIFI, 3G, Location based on network, html 5 compliant browser and thanks to Android open environment as developer you can use all that services and content in the phone with no limits to innovate. I suppose that everyone knows foursquare. Foursquare is a location-base social network you are in some place, you check in that place and you win badges and mayor ships. I am going to show you how to make foursquare for Android. Well with no places content but Foursquare basically uses maps and location. So In this session I am going to show you one of the powerful things of Android the integration of Google maps and Location in applications.
  • So Let's Start, I guess most of people in this room has been working with eclipse and android sdk because for this session I am not going to talk about Android fundamentals so everything you need to start in Android, tutorials, samples, api reference is in
  • First I am going to show you how to integrate Google Maps on your Application, then I’ll continue with Location on Android and Finally I will give you the link with the code and you can ask me questions about this session
  • Difference between google maps for website and google maps android
  • Las clases más importantes de la libreria son estas. MapView(ItemizedOverlay(Item(GeoPoint))))
  • 24/06/09 24/06/09
  • 24/06/09
  • 24/06/09
  • 24/06/09
  • Imagine that your user has disable the GPS location and you use the gps as provider, you ll get a beauty force close so the best practices is use a criteria to get the best provider for every moment.
  • Google maps
  • Location listener receive the notification from location manager on location change and trigger method that update de ui with new data that’s similar to swing.
  • Google Maps in Android

    1. 1. Social network <ul><li>Twitter Hashtag: #m2eu #android </li></ul><ul><li>Personal twitter: @rallat </li></ul>Israel Ferrer - @rallat –
    2. 2. Who am I?  <ul><li>Israel Ferrer Camacho </li></ul><ul><ul><li>co-founder & </li></ul></ul><ul><ul><li>Business Developer at </li></ul></ul><ul><ul><li>Android Developer </li></ul></ul><ul><ul><ul><li>Trovit homes: </li></ul></ul></ul><ul><ul><ul><li> news: </li></ul></ul></ul><ul><ul><ul><li>Rac1: </li></ul></ul></ul><ul><ul><ul><li>Bubiloop recommender: </li></ul></ul></ul><ul><ul><ul><li>Working on app </li></ul></ul></ul>Israel Ferrer - @rallat –
    3. 3. 10/08 Israel Ferrer - @rallat -
    4. 4. meetup 06/09 Israel Ferrer - @rallat -
    5. 5. Campus Party 08/09 Israel Ferrer - @rallat -
    6. 6. Android workshops 09/10 Israel Ferrer - @rallat –
    7. 7. Bubiloop 10/09 Israel Ferrer - @rallat –
    8. 8. Androides Barcelona 2010 <ul><li>Co-founder of Barcelona Android dev group </li></ul>Israel Ferrer - @rallat –
    9. 9. Mobile Cocktail 02/10 Israel Ferrer - @rallat –
    10. 10. Google I/O 2010 Israel Ferrer - @rallat –
    11. 11. Location and Maps in Android <ul><li>Israel Ferrer Camacho </li></ul><ul><li>June 17, 2010 </li></ul>Israel Ferrer - @rallat –
    12. 12. Israel Ferrer - @rallat –
    13. 13. Agenda <ul><li>Google Maps in Android </li></ul><ul><li>Location in Android </li></ul><ul><li>Show me the code </li></ul><ul><li>Questions </li></ul>Israel Ferrer - @rallat –
    14. 14. Google Maps in Android <ul><ul><li>Google Maps is an external library to the Android SDK. </li></ul></ul>Israel Ferrer - @rallat – Features Google Maps Google Maps Android World Maps Mode Sat/Street View/Traffic Places content Compass
    15. 15. Google Maps in Android <ul><li>GeoPoint: longitude/latitude stored as integer in microdegrees (degrees * 1E6) </li></ul><ul><li>Overlay: Base class representing an overlay which may be displayed on top of a map </li></ul><ul><li>OverlayItem: The basic component of any ItemizedOverlay. </li></ul><ul><li>ItemizedOverlay : A base class for an Overlay which consists of a list of OverlayItems </li></ul>Israel Ferrer - @rallat –
    16. 16. Google Maps in Android <ul><li>MapActivity: Base class with code to manage the boring necessities of any activity that displays a MapView </li></ul><ul><li>MapView: A View which displays a map (with data obtained from the Google Maps service). </li></ul><ul><li>MapController: A utility class to manage panning and zooming of a map. </li></ul><ul><li>MyLocationOverlay: An Overlay for drawing the user's current location (and accuracy) on the map, and/or a compass-rose inset. </li></ul>Israel Ferrer - @rallat –
    17. 17. Google Maps in Android <ul><ul><li>¿ What? </li></ul></ul><ul><ul><ul><li>We can show custom markers with info at someplace in a map </li></ul></ul></ul><ul><ul><li>¿How? </li></ul></ul><ul><ul><ul><li>Prerequisites </li></ul></ul></ul><ul><ul><ul><li>Show the map using MapView </li></ul></ul></ul><ul><ul><ul><li>Create our custom marker class </li></ul></ul></ul><ul><ul><ul><li>MapActivity: </li></ul></ul></ul><ul><ul><ul><ul><li>Add marker to our located overlays </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Add this located overlays to our MapView </li></ul></ul></ul></ul>Israel Ferrer - @rallat –
    18. 18. Prerequisites <ul><li>Create an Android project with Google APIs support </li></ul>Israel Ferrer - @rallat –
    19. 19. Prerequisites <ul><li>Manifest Permissions: </li></ul><ul><ul><li>Add permission to use Google Maps external library </li></ul></ul><ul><ul><li><uses-library android:name=&quot;; /> </li></ul></ul><ul><ul><li>Add permission to use Internet </li></ul></ul><ul><ul><li><uses-permission android:name=&quot;android.permission.INTERNET&quot; /> </li></ul></ul><ul><li>Google Maps API key for mobile: </li></ul><ul><ul><li> </li></ul></ul>Israel Ferrer - @rallat –
    20. 20. MapView <ul><li>XML Definition MapView </li></ul><ul><li>  </li></ul>Israel Ferrer - @rallat –
    21. 21. MapActivity <ul><li>Create MapActivity to show the MapView </li></ul>Israel Ferrer - @rallat –
    22. 22. MyLocationOverlay <ul><li>This object create an overlay that shows your location. </li></ul>
    23. 23. Custom Marker <ul><li>Object that extends ItemizedOverlay </li></ul><ul><li>Object is initialize with a Drawable our custom marker </li></ul>
    24. 24. Custom Marker <ul><li>Populate our custom marker ItemizedOverlay with OverlayItems </li></ul><ul><li>Finally, add our custom marker Overlay to MapView Overlays </li></ul>
    25. 25. Hello Map! Israel Ferrer - @rallat –
    26. 26. To Sum Up Israel Ferrer - @rallat –
    27. 27. Location in Android <ul><ul><li>¿ What? </li></ul></ul><ul><ul><ul><li>Location-based services are technique to figure out where you are </li></ul></ul></ul><ul><ul><li>¿How? </li></ul></ul><ul><ul><ul><li>Prerequisites </li></ul></ul></ul><ul><ul><ul><li>Location Manager </li></ul></ul></ul><ul><ul><ul><li>Location Listener </li></ul></ul></ul>Israel Ferrer - @rallat –
    28. 28. Prerequisites <ul><li>Manifest Permissions </li></ul><ul><ul><li>GPS Location </li></ul></ul><ul><ul><ul><li><uses-permission android:name=&quot;android.permission.ACCESS_FINE_LOCATION&quot;/> </li></ul></ul></ul><ul><ul><li>Network Location </li></ul></ul><ul><ul><li><uses-permission android:name=&quot;android.permission.ACCESS_COARSE_LOCATION&quot;/> </li></ul></ul>Israel Ferrer - @rallat –
    29. 29. Location Manager <ul><li>Location-Based Services (LBS) are handle using the LocationManager </li></ul><ul><li>Two Location providers in Android: GPS, Network </li></ul><ul><li>Define Criteria object to obtain the best provider </li></ul>Israel Ferrer - @rallat –
    30. 30. Location Manager <ul><li>One we get the best provider is time to get location </li></ul><ul><ul><li>Get last know location </li></ul></ul><ul><ul><li>Get the location changes </li></ul></ul><ul><ul><ul><li>Request Location Manager this updates </li></ul></ul></ul>Israel Ferrer - @rallat –
    31. 31. Location Listener <ul><ul><ul><li>Used for receiving notifications from the LocationManager when the location has changed </li></ul></ul></ul>Israel Ferrer - @rallat –
    32. 32. To Sum Up Israel Ferrer - @rallat –
    33. 33. Maps and Location <ul><li>Easy to use in your apps </li></ul><ul><li>Once we’ve got the location, we can show data on the map just with the method update(location) to refresh de UI </li></ul>Israel Ferrer - @rallat –
    34. 34. Q&A <ul><li>All the source from this session is in </li></ul><ul><li> </li></ul><ul><li>Questions? </li></ul>Israel Ferrer - @rallat –
    35. 35. Thanks <ul><li>Twitter: @rallat </li></ul><ul><li>Mail: </li></ul><ul><li>Projects: & </li></ul>Israel Ferrer - @rallat -
    1. A particular slide catching your eye?

      Clipping is a handy way to collect important slides you want to go back to later.