As a developer, it is expected of you to learn new things frequently because techniques and approaches evolve often.
I know this can be pretty much difficult especially if you have an 8 to 5 job where deadlines and the likes won’t help matters.
Enough story :D.
I recently worked on an android project that required me using Maps API. I had idea of how to go about in my head (this is a common thing) but I have never really worked with too many APIs from google play services.
Get your SHA1 certificate fingerprints by typing this (keytool -list -v -keystore “%USERPROFILE%\.android\debug.keystore” -alias androiddebugkey -storepass android -keypass android) on your command prompt. Note your SHA1 key
Enter your project name
Select Google Maps Android API
Select Credentials from the left pane and click on CREATE NEW KEY.Then you select Android Key
Insert your SHA1 certificate fingerprints and package name separated by a semi-colon (e.g 45:B5:E4:6F:36:AD:0A:98:94:B4:02:66:2B:12:17:F2:56:26:A0:E0;com.example) and generate a new key
Most of the tutorials I found used Eclipse and I wanted it done in Android Studio (AS).
One of my many challenges was gradle (we all know this feeling). I didnt have an updated version of google play services and gradle no gree. That was solved gallantly.
I successfully had a successful implementation with the help of a colleague and I feel like sharing the knowledge won’t do me any harm. Would it? ;).
Yaayy! We have a new API key for our android app. You should have something like this.
Create a new Activity in your project and select Maps Activity (New>>Google>>Google Maps Activity)
At this point, AS should help you pull the needed dependencies. Any luck with gradle? If you have any challenge, mention me on twitter.
Replace the key in the google_maps_api.xml with the key that was generated in the console.
Just for a check. Confirm that your AndroidManifest.xml has the right permissions
Run your project and all these should have led you to a successful journey on Maps. See my screenshot below.
Now all you need do is play around with Location class and fix your longitude and latitude.
This post was published on teckhood first