Google Maps in Android

9,944
-1

Published on

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

Published in: Technology
1 Comment
6 Likes
Statistics
Notes
  • I need Google maps GUI design code.plz help me
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
No Downloads
Views
Total Views
9,944
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
640
Comments
1
Likes
6
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 and.roid.es, 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 developer.android.com.
  • 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 – israel@bubiloop.com
    2. 2. Who am I?  <ul><li>Israel Ferrer Camacho </li></ul><ul><ul><li>co-founder and.roid.es & bubiloop.com </li></ul></ul><ul><ul><li>Business Developer at bubiloop.com </li></ul></ul><ul><ul><li>Android Developer </li></ul></ul><ul><ul><ul><li>Trovit homes: http://bblp.to/10rN </li></ul></ul></ul><ul><ul><ul><li>and.roid.es news:  http://bblp.to/11E6 </li></ul></ul></ul><ul><ul><ul><li>Rac1: http://bblp.to/10uh </li></ul></ul></ul><ul><ul><ul><li>Bubiloop recommender: http://bblp.to/11Hg </li></ul></ul></ul><ul><ul><ul><li>Working on salir.com app </li></ul></ul></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    3. 3. And.roid.es 10/08 Israel Ferrer - @rallat - israel@bubiloop.com
    4. 4. And.roid.es meetup 06/09 Israel Ferrer - @rallat - israel@bubiloop.com
    5. 5. Campus Party 08/09 Israel Ferrer - @rallat - israel@bubiloop.com
    6. 6. Android workshops 09/10 Israel Ferrer - @rallat – israel@bubiloop.com
    7. 7. Bubiloop 10/09 Israel Ferrer - @rallat – israel@bubiloop.com
    8. 8. Androides Barcelona 2010 <ul><li>Co-founder of Barcelona Android dev group </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    9. 9. Mobile Cocktail 02/10 Israel Ferrer - @rallat – israel@bubiloop.com
    10. 10. Google I/O 2010 Israel Ferrer - @rallat – israel@bubiloop.com
    11. 11. Location and Maps in Android <ul><li>Israel Ferrer Camacho </li></ul><ul><li>June 17, 2010 </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    12. 12. developer.android.com Israel Ferrer - @rallat – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com 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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    18. 18. Prerequisites <ul><li>Create an Android project with Google APIs support </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    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;com.google.android.maps&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>http://tinyurl.com/androidkeyapi </li></ul></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    20. 20. MapView <ul><li>XML Definition MapView </li></ul><ul><li>  </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    21. 21. MapActivity <ul><li>Create MapActivity to show the MapView </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    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 – israel@bubiloop.com
    26. 26. To Sum Up Israel Ferrer - @rallat – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    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 – israel@bubiloop.com
    32. 32. To Sum Up Israel Ferrer - @rallat – israel@bubiloop.com
    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 – israel@bubiloop.com
    34. 34. Q&A <ul><li>All the source from this session is in </li></ul><ul><li>http://bblp.to/mobile20 </li></ul><ul><li>Questions? </li></ul>Israel Ferrer - @rallat – israel@bubiloop.com
    35. 35. Thanks <ul><li>Twitter: @rallat </li></ul><ul><li>Mail: israel@bubiloop.com </li></ul><ul><li>Projects: bubiloop.com & and.roid.es </li></ul>Israel Ferrer - @rallat - israel@bubiloop.com
    1. A particular slide catching your eye?

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

    ×