Android google mapv2

662 views

Published on

Published in: Technology, News & Politics
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
662
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
12
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Android google mapv2

  1. 1. Android GoogleMap V2 資管系研⼀一 鍾聖彥 TA 指導⽼老師 余仁朋 博⼠士
  2. 2. Agenda • Features • Showcase • How to begin and develop? • Q&A
  3. 3. Google Map V2 Features • 3D Rendering • Draw on the Map • • • • • Customize markers and info windows, or add polylines and polygons. Vector Tiles Faster Loading with fewer demands on bandwidth. Gesture Control Intuitive tilt, rotate and zoom gesture controls. • Indoor Floor Plans • Location Services 3
  4. 4. Showcases(1/3)
  5. 5. Showcases(2/3)
  6. 6. Showcases(3/3) More…
  7. 7. How to Begin and Develop? Answer is step by step.And learning example.
  8. 8. Downloading Google Play Services Open Eclipse Windows Android SDK Manager
  9. 9. Importing Google Play Services into Eclipse File Import Android Existing Android Code Into Workspace Windows os :android-sdk-windowsextrasgooglegoogle_play_serviceslibprojectgoogle-play-services_lib
  10. 10. Getting the Google Maps API key Window Preferences Android Build We need to copy SHA1 fingerprint like this : C1:C8:C4:5F:15:82:BC:85:E2:5B:CA:F2:6F:C3:EF:02:01:A1:F2:F4
  11. 11. Now open Google API Console If you have no Google Account…please hurry to registry
  12. 12. Enabled Google Maps Android API v2 We need to copy SHA1 fingerprint like this : C1:C8:C4:5F:15:82:BC:85:E2:5B:CA:F2:6F:C3:EF:02:01:A1:F2:F4
  13. 13. New Project We need to copy SHA1 fingerprint like this : C1:C8:C4:5F:15:82:BC:85:E2:5B:CA:F2:6F:C3:EF:02:01:A1:F2:F4
  14. 14. Registered apps We need to copy SHA1 fingerprint like this : C1:C8:C4:5F:15:82:BC:85:E2:5B:CA:F2:6F:C3:EF:02:01:A1:F2:F4 Package Name要與專案package相同
  15. 15. ⾛走上這條路都是為了它... AIzaSyDacsY4MMgCfjc5A4IwLS6LQpz1ykIgzJk
  16. 16. Creating New Project File New Android Application Project We need to copy Map API Key like this : AIzaSyDacsY4MMgCfjc5A4IwLS6LQpz1ykIgzJk
  17. 17. Google Play Services project as a library to use project. So right click on project and select properties. We need to copy Map API Key like this : AIzaSyDacsY4MMgCfjc5A4IwLS6LQpz1ykIgzJk
  18. 18. Add the Map Key in the manifest file. We need to copy Map API Key like this : AIzaSyDacsY4MMgCfjc5A4IwLS6LQpz1ykIgzJk <meta-data android:name="com.google.android.maps.v2.API_KEY" android:value="API_KEY"/> <meta-data android:name="com.google.android.gms.version" android:value="@integer/google_play_services_version" />
  19. 19. Google maps needs following permissions and features. ACCESS_NETWORK_STATE – To check network state whether data can be downloaded or not
 INTERNET – To check internet connection status
 WRITE_EXTERNAL_STORAGE – To write to external storage as google maps store map data in external storage
 ACCESS_COARSE_LOCATION – To determine user’s location using WiFi and mobile cell data
 ACCESS_FINE_LOCATION – To determine user’s location using GPS
 OpenGL ES V2 – Required for Google Maps V2
  20. 20. GoogleMap Layout <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"     android:layout_width="fill_parent"     android:layout_height="fill_parent" >     <fragment         android:id="@+id/map"         android:name="com.google.android.gms.maps.MapFragment"         android:layout_width="match_parent"         android:layout_height="match_parent"/> </RelativeLayout>
  21. 21. Let’s Coding.
  22. 22. Placing a Marker // latitude and longitude double latitude = ; double longitude = ;   // create marker MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps ");   // adding marker googleMap.addMarker(marker);
  23. 23. Changing Marker Color // ROSE color icon marker.icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_ROSE));   // GREEN color icon marker.icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_GREEN)); !
  24. 24. Changing Marker Color // ROSE color icon marker.icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_ROSE));   // GREEN color icon marker.icon(BitmapDescriptorFactory.defaultMarker( BitmapDescriptorFactory.HUE_GREEN)); !
  25. 25. Custom Marker Icon // latitude and longitude double latitude = 17.385044; double longitude = 78.486671;   // create marker MarkerOptions marker = new MarkerOptions().position(new LatLng(latitude, longitude)).title("Hello Maps");   // Changing marker icon marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.my_marker_icon)));   // adding marker googleMap.addMarker(marker);
  26. 26. Moving Camera to a Location with animation CameraPosition cameraPosition = new CameraPosition.Builder().target(                 new LatLng(17.385044, 78.486671)).zoom(12).build();   googleMap.animateCamera(CameraUpdateFactory.newCameraPosition (cameraPosition));
  27. 27. Changing Map Type googleMap.setMapType(GoogleMap. MAP_TYPE_NORMAL); googleMap.setMapType(GoogleMap. MAP_TYPE_HYBRID); googleMap.setMapType(GoogleMap. MAP_TYPE_SATELLITE); googleMap.setMapType(GoogleMap. MAP_TYPE_TERRAIN); googleMap.setMapType(GoogleMap. MAP_TYPE_NONE);
  28. 28. Q&A
  29. 29. Reference https://developers.google.com/maps/documentation/ android/ ! https://developers.google.com/maps/showcase/ ! http://www.androidhive.info/2013/08/android-workingwith-google-maps-v2/ ! http://blog.xuite.net/alenliu/test/66754055

×