This is a simple project to integrate Google map into Android Studio. Here, I generate Maps SDK for Android and API key. These are the steps which I follow
- Create New Project.
- Select Template (Google Maps Activity).
- Open google_maps_api.xml
- Welcome page of my google cloud console account (https://console.cloud.google.com)
- Create a new project and Click Create API Key button.
- Generated API KEY (Maps SDK for Android)
- Check whether API services are enabled or not.
- Copy the API KEY and paste it to the google_maps_api.xml file (Android Studio).
- Select the MapsActivity.java file from the APP->Java directory.
- Run the default code (application) and get the emulator/device output.
Then, add Longitude and Latitude for Google Maps on Android (hardcoded values). After that,
- Implement the code inside the onCreate method and get the Longitude and Latitude using the getFromLocation() method.
- Add your hometown address (String values).
- Implement getLongitude(), getLatitude(), getCountryName().
- Run and get the above three values using the Logcat view.
Finally, show the current location