Google Map - person-in-hangang/HanRiver GitHub Wiki
Google Map
Google offers a wide range of services, and Android developers are free to use Google's services to develop apps through a series of procedures. Among them, Google Map is the easiest and most useful to use. If you want to use this api, you have to log in the google cloud platform.
How to install
Step 1. Create a project
After login, go to Console. And create new project.
Step 2. Get an API keyEnable the APIs or SDKs to use with project on Cloud Console
Enter the user authentication information and get an API key.
Then check Android in application restrictions. And enter package name and digital fingerprints in usage limits of Android app.
Step 3. Enable the APIs or SDKs to use with project on Cloud Console
Open Android studio and download Google Play services in SDK Tools.
Step 4. Code part
Set build.gradle.
dependencies {
...
implementation 'com.google.android.gms:play-services-maps:17.0.0'
...
}
Add API key value and required properties.
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.notice">
...
<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION"/>
...
...
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="google_maps_api" />
And make up the layout.
<?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:map="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/map"
android:name="com.google.android.gms.maps.SupportMapFragment"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MapsActivity" />
You can refer to this.