- #Adding google maps in android studio fragment android#
- #Adding google maps in android studio fragment windows#
#Adding google maps in android studio fragment android#
In Android Studio, create a new project, I named mine MapDemo01. After clicking the Create button, you will be shown an API key that we will use in our app. Use the Add package name and fingerprint button to add your app’s package name (I used 01) and your SHA1 fingerprint. In the next dialog, you can change the key name but I left it as the default Android key 1 Select Google Maps Android API and click the Enable API button that appears on the next page.Īfter the API is enabled, click Go to Credentials, from the left panel.įrom the Add Credentials menu, select API Key. You will be taken to the project’s dashboard, in the center of the screen click ‘Use Google APIs’. Click the Create Project button to create a new project and name it SP Map Demo. Keep the Terminal window open and head over to the to the Google Developer Console. The Terminal will show the MD5 and SHA1 certificate fingerprints, we want the SHA1.
#Adding google maps in android studio fragment windows#
To see details of the certificate, run the following: Linux or OS X keytool -list -v -keystore ~/.android/debug.keystore -alias androiddebugkey -storepass android -keypass android Windows keytool -list -v -keystore "%USERPROFILE%\.android\debug.keystore" -alias androiddebugkey -storepass android -keypass android Windows: C:\Users\yourusername.android\.The file is named debug.keystore and by default, it’s stored in the same directory as your Android Virtual Device (AVD) files: The Android SDK tools generate a debug certificate automatically when creating a debug build for the first time, so all we have to do is retrieve it. While you’re developing and testing, you should use a debug certificate (which we’ll cover shortly), but when publishing the app, you have to use a release certificate (you can find instructions for generating a release certificate here). The API key is based on a short form of your app’s digital certificate, known as its SHA-1 fingerprint. To use the Google Maps Android API, you must register your app project on the Google Developers Console and get a Google API key to add your app. The completed project can be downloaded here. We won’t cover everything as that would take several posts, but we will cover common features like adding a map to the view, changing the map type, adding a marker to the map to mark a location and configuring the camera which will affect how the user sees a map. We’ll create an application that will show some of the features available in the API. These objects provide additional information for map locations and allow user interaction with the map. You can use the API calls to add markers, polygons, and overlays to a basic map and to change the user’s view of a particular map area. The API automatically handles access to Google Maps servers, data downloading, map display, and response to map gestures. In this article, we’ll look at the Google Maps Android API which enables you to add maps based on Google Maps to your application. Getting lost is becoming a thing of the past, as we can conveniently carry in our pockets a map of not just the whole planet, but one that will show you where you are, give directions to where you want to go, the estimated time it will take to get there, let you mark points of interest and save them for later, enable you to search for places that are close by and much more. In the past, traveling to a new or unfamiliar location typically required you to carry around a local map and/or ask locals for directions.