Prerequisites
We are going to create the project completely with Android Studio. We will start by creating a new project in Android Studio. Here, I have used the package name as packt.mycustommap
. You can use the package name of your choice.
You will then have to register your application in the Google Developer Console with the SHA1 fingerprint and package name, and obtain the API key.
Instead of hardcoding the string, it is recommended that we define the string variables in strings.xml
in res/values/strings.xml
.
Make sure your activity extends to AppCompatActivity
.
Adding dependencies
The dependencies should be added to the app's build.gradle
file. Our app depends on the Google Play services library and the Android design support library.
Add the following dependencies to build.gradle
:
compile 'com.google.android.gms:play-services:7.5.0' compile 'com.android.support:design:22.2.0'
The complete dependencies look similar to the following code:
dependencies { compile...