Tuesday, October 13, 2015

Android Studio template of Google Maps Activity

This video show how to create Android App with Maps using Android Studio template of Google Maps Activity.


- You have to generate Google Maps API key with the prepared link in values/google_maps_api.xml, replace the string of "google_maps_key", refer to the video.
- This key is generated using debug.keystore, if you want to generate release APK, you have to generate another key using release keystore.
- The key show in the video is generated using the debug.keystore in my development PC, it will not work on your PC. You have to geneerate yourself.


The key will be refered in AndroidManifest.xml, inside <meta-data> of "com.google.android.geo.API_KEY".

Also include <uses-permission> of "android.permission.ACCESS_FINE_LOCATION".


Check the file build.gradle, dependencies of compile 'com.google.android.gms:play-services:8.1.0' is added for you.


"com.google.android.gms.maps.SupportMapFragment" is used to display map on your app.  It's a wrapper around a view of a map to automatically handle the necessary life cycle needs.






Step-by-step of Android Google Maps Activity using Google Maps Android API v2, on Android Studio:
Display "Legal Notices" for Google Maps Android API v2 on Options Menu
Set map type for Google Maps Activity using Google Maps Android API v2
Add Marker to Google Map (Google Maps Android API v2)
- Initialize map in xml
Detect touch on GoogleMap, onMapClick() and onMapLongClick()
Make GoogleMap's marker draggabe and detect moving marker
Custom InfoWindow
Detect user click on InfoWindow, by implementing GoogleMap.OnInfoWindowClickListener()
Display StreetViewPanoramaView in DialogFragment, when user click on InfoWindow
- to be continue...

No comments:

Post a Comment