Google Maps has been a lifesaver for lost people everywhere since its initial release back in 2005. Over a billion people use Google Maps every month, and there are over 5 million active users every week. So being able to place a map to your own application can be a huge advantage.
This is exactly what Maps SDK allows you to do.
How Does Maps SDK Work?
Maps SDK is an Application Programming Interface (API). It’s a software intermediary. For all you non-tech savvy people, that means that the program was made to make two or more different software applications work together.
Think of it as a child custody agreement between two stubborn parents. The API dictates what data can be shared, how the data is shared, and what format the data needs to be in as well as giving instructions on any other way that the programs interact with each other.
You might ask yourself why an API is important. This question gets answered when you think about two different but complementary apps or services. Let’s say that the first application is a music streaming service, like Hulu, and the second is a service for streaming like Fire or Apple TV.
In order to use the service, the application has to give certain information to Amazon (Fire TV) and vice versa. But sometimes, they just aren’t compatible with the device you are streaming on. For example, with Amazon, you can stream Hulu on several of its devices, but you can’t on the regular Echo Dot (using it as a Bluetooth speaker is a topic for a different day).
This is where the API comes into play. It will tell both programs if it’s compatible and can be used without the programmers having to create new code for compatibility.
This is what Maps SDK is made for — convenience in placing a map in your separate application while using data from Google Maps.
According to Google, “You can also use API calls to add markers, polygons, and overlays to a basic map, and to change the user’s view of a particular map area. These objects provide additional information for map locations, and allow user interaction with the map.” Essentially, Map SDK also allows you to add various graphics to a map.
How to Get Started With Google Maps SDK?
There are a few things that you need to do before you can use Maps SDK in your application.
First, you need familiar with Android/iOS development and object-oriented programming concepts as well as being familiar with Google Maps as a user. If you or your team is good with these, just move on to the next prerequisite; if not, it seems like you might have some studying or networking to do.
The first real step is making sure that you have the Android Studio downloaded and installed as it is the recommended development environment for Maps SDK on Android. You will also need to have a billing account on the Google Platform.
Once you have done that, you will then need to add Google Play services Android Studio. Start by opening the Android Studio. Then click on Tools and select the SDK Manager You’ll want to make sure that the checkbox next to it is showing a checkmark.
Create a Project
Next, you’ll need to create a Google Maps project. This part has a few substeps of its own; first, you will need to launch Android Studio. Second, from the Welcome to Android Studio box click Start a new Android Studio project. Alternately you can also click File on the menu bar, then New, and finally New Project.
Now that you have the ‘Choose your project dialog box’ open, you can choose the tab that corresponds with the platform you are developing for. The default is Phone and Tablet. The next mini step is to select Google Maps Activity and then click Next. The final step in creating a project is “adding your app name, package name, and project location, programming language, and the minimum Android API level supported by your app, then click Finish.”
Now that you have your new project, you have to get a Google Maps API key. There are three ways to get the API key “the fast, easy way” the “slightly less fast way,” and if they don’t work, then you can follow “the full process for getting an API key.”
Once you have the API key, its time to look at some code to make sure that it has the specific code you are looking for in the template. In particular, you will need to look at the XML layout file and the maps activity Java file, which are located at res/layout/activity_maps.xml, and MapsActivity.java, respectively.
Linking Your Android
The next step is to connect an Android device so you can see how your app works in real-time. This can be done by simply connecting any Android device to your computer after you have enabled developer options on the device. If you don’t have an Android device or don’t want to connect one you can also use an Android Simulator to run the app although you will need to ensure that it emulates Android 4.2.2 or higher as well as a few other settings. So we recommend just connecting an Android device.
The last — and most exciting step — is to build and run your app. Once you have verified the code is satisfactory to you all that is left is to click the Run menu option in Android Studio and when prompted select the device connected to the computer and click OK then your app will be built and your results will be shown on the device.
Checklist for Opening Google Maps SDK
While the longer directions are great, it can be helpful to have a quick checklist to guide you. If there are any questions on following this just go back to the previous section and follow the detailed instructions and links.
- Download Android Studio.
- Install Google Play service.
- Create a new Google Maps project.
- File > New > New Project
- Select the corresponding tab for the platform you developed the app for.
- Select Google Maps Activity
- Enter pertinent app information
- Get a Google Maps API Key.
- Look at the code to verify that it’s correct.
- Connect an Android device to your computer.
- Build and run the application.
Final Thoughts
Google Maps SDK is a must-have API for an app developer that is wanting to include an interactive map within their application that is back by the power of Google Maps.
Join The Discussion: