This project is a comprehensive implementation of Google Maps features, including finding and marking device locations, keyword location searching, autocomplete suggestions, changing map styles, and integrating various Google Maps APIs.
- Find and Mark Device Locations: Automatically locate and mark the user's current location on the map.
- Keyword Location Searching and Autocomplete Suggestions: Search for locations using keywords with real-time autocomplete suggestions.
- Change Map Styles: Dynamically switch between different map styles, such as day and night modes.
- Google Maps APIs: Integration with various Google Maps APIs for enhanced functionality.
- Haversine Algorithm: Utilizes the Haversine algorithm to calculate the shortest distance between points and determine the nearest station to the user's location.
-
Maps SDK for Android
- Usage: To display the map, handle user interactions, and add markers or shapes.
- Example:
map.addMarker(MarkerOptions().position(currentLatLng).title("You are here"))
-
Places API
- Usage: To search for places, get place details, and provide autocomplete suggestions.
- Example:
val placeFields = listOf(Place.Field.ID, Place.Field.NAME, Place.Field.LAT_LNG) val request = FetchPlaceRequest.newInstance(placeId, placeFields) placesClient.fetchPlace(request)
-
Distance Matrix API
- Usage: To calculate the travel distance and time between multiple origins and destinations.
- Example:
val origins = "40.6655101,-73.89188969999998" val destinations = "40.659569,-73.933783|40.729029,-73.851524|40.6860072,-73.6334271|40.598566,-73.7527626" directionsService.getDistanceMatrix(origins, destinations, apiKey)
-
Directions API
- Usage: To get route information between an origin and a destination, including step-by-step directions.
- Example:
directionsService.getDirections(origin, destination, apiKey)
-
Routes API
- Usage: To calculate and display multiple routes from an origin to a destination.
- Example:
routeDrawingService.getRoutes(origin, destination, apiKey)
To run this project, follow these steps:
-
Clone the Repository:
git clone https://github.com/your-username/maps-project.git cd maps-project -
Open in Android Studio: Open the project in Android Studio.
-
Add Google Maps API Key:
- Obtain an API key from the Google Cloud Console.
- Add the API key to your
local.propertiesfile:MAPS_API_KEY=YOUR_API_KEY_HERE
-
Add JitPack Repository (if using libraries from JitPack):
allprojects { repositories { google() mavenCentral() maven { url "https://jitpack.io" } } }
This project is licensed under the MIT License. See the LICENSE file for details.







