Android Maps Extensions
Ana Baotić
Android Maps v2
Android Maps v2 (end of 2012.)
●
no more extending MapActivity
●
simpler way to add markers (no more exten...
Adding a map#AndroidManifest
●
<meta-data
android:name="com.google.android.maps.v2.API_KEY"
android:value="API_KEY"/>
●
<u...
Adding a map#layout
Adding a map#activity
Adding a marker
App requirements
●
Add a marker for each poi
●
Show different icon (selected) in marker's onClick event
(change icon)
●
Di...
Problems
●
Cannot change properties of an existing marker
– remove the marker and add a new one
– until Google play servic...
Android Maps Extensions lib
●
http://androidmapsextensions.com/
●
Object getData() and setData(Object) on Marker, Circle,
...
Basic implementation
●
Extend SupportMapFragment
●
call getExtendedMap instead of getMap on
SupportMapFragment (or MapView)
Code example
Prerequisites
●
Maven Central repo (added three weeks ago)
– dependencies {
– compile 'com.google.android.gms:play-service...
Google Maps Android API Utility
Library
●
Enables advaced features
– Customization of markers via bubble icons
– Markers a...
Links
●
Intro to Android Google Maps
– https://developers.google.com/maps/documentation/android/intro
●
Old maps reference...
Thank you!
Upcoming SlideShare
Loading in …5
×

Infinum Android Talks #02 - Android Maps Extensions

683 views

Published on

With the highly anticipated v2 update of Google Maps for Android we made a big leap forward, with just a couple of steps back. We will show you what has changed, what new problems arose and how Android Maps Extensions helped us solve them.

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

  • Be the first to like this

No Downloads
Views
Total views
683
On SlideShare
0
From Embeds
0
Number of Embeds
4
Actions
Shares
0
Downloads
5
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Infinum Android Talks #02 - Android Maps Extensions

  1. 1. Android Maps Extensions Ana Baotić
  2. 2. Android Maps v2 Android Maps v2 (end of 2012.) ● no more extending MapActivity ● simpler way to add markers (no more extending ItemizedOverlay) ● fine tuning: position, anchor, color, icon, snippet, title, etc https://developers.google.com/maps/documentation/android/marker #add_a_marker
  3. 3. Adding a map#AndroidManifest ● <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="API_KEY"/> ● <uses-permission android:name="android.permission.INTERNET"/> ● <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/> ● <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> ● <uses-permission android:name="com.google.android.providers.gsf.permission.READ_GSERVICES"/> ● <uses-feature android:glEsVersion="0x00020000" android:required="false"/> ● <uses-library android:name="com.google.android.maps" />
  4. 4. Adding a map#layout
  5. 5. Adding a map#activity
  6. 6. Adding a marker
  7. 7. App requirements ● Add a marker for each poi ● Show different icon (selected) in marker's onClick event (change icon) ● Display full poi information (get poi object for selected marker) ● Remove marker from map (get marker from the map for a specific poi)
  8. 8. Problems ● Cannot change properties of an existing marker – remove the marker and add a new one – until Google play services rev.7 ● Marker has no knowledge of its poi – store KV pairs in an arbitrary structure – getId() method (unreilable), setId(Object value) non existent – cannot get a marker on the map by an id ● Cannot extend the Marker class – public final class Marker
  9. 9. Android Maps Extensions lib ● http://androidmapsextensions.com/ ● Object getData() and setData(Object) on Marker, Circle, GroundOverlay, Polygon, Polyline, etc. ● List<Marker> GoogleMap.getDisplayedMarkers() ● List<Marker> GoogleMap.getMarkers() ● List<Circle> GoogleMap.getCircles() ● List<GroundOverlay> GoogleMap.getGroundOverlays() ● boolean Circle.contains(LatLng) ● Marker GoogleMap.getMarkerShowingInfoWindow()
  10. 10. Basic implementation ● Extend SupportMapFragment ● call getExtendedMap instead of getMap on SupportMapFragment (or MapView)
  11. 11. Code example
  12. 12. Prerequisites ● Maven Central repo (added three weeks ago) – dependencies { – compile 'com.google.android.gms:play-services:4.0.30' – compile 'com.androidmapsextensions:android-maps- extensions:2.0+' } ● External library for Eclipse projects
  13. 13. Google Maps Android API Utility Library ● Enables advaced features – Customization of markers via bubble icons – Markers are more like info windows – Markers can be styled – Cluster manager – PolyUtil for converting polylines and polygons to latlng – Enabled interoperability with Google Maps API web services – SphericalUtil for computation of distances, areas and headings base on latitudes and longitudes
  14. 14. Links ● Intro to Android Google Maps – https://developers.google.com/maps/documentation/android/intro ● Old maps reference – https://developers.google.com/maps/documentation/android/v1/hello-ma pview?hl=en ● Android maps extenstions – https://code.google.com/p/android-maps-extensions/ ● Android maps utils library – http://googlemaps.github.io/android-maps-utils/
  15. 15. Thank you!

×