Uses a hybrid system where parts of the custom pins and clustering system methods were being used to display pins in clusters in Jetpack Compose. The library was not updated by Google for Jetpack Compose, and was mainly used in Fragments.
This also uses the Earlier releases of Kotlin Result in a Retrofit Adapter. It uses Kotlin's Result type to wrap API responses in a type-safe way. All Retrofit calls return a Result, allowing clean and centralized handling of both success and error cases:
launchIO {
yelpRepository.getBusinessesByLatLng(latLong, radius)
.onSuccess { businessList ->
yelpBusinessState.value = businessList
}.handleFailure()
}
}
Can view some of the code here: data/src/main/java/com/bottlerocketstudios/mapsdemo/infrastructure/retrofitadapter
- Get the API Key at https://mapsplatform.google.com and click on get started. (You might need to setup billing).
- In the console click on the left hamburger menu on the top-most left hand side of the site and choose
API & Services>credentials. - Click on Create Credentials found on the top-middle of the website and choose API Key, Copy this API key which you will be using for this demo.
- On the dialog box click on edit API key. You can choose
Nonefor the application restrictions if you're only testing out the demo. Otherwise choose Android apps and follow the directions. - Choose library from the side menu and click on Maps SDK for Android, on the next screen choose Enable.
- If you need the Places API you will also need to locate it from the list of library options and enable this as well.
- Back in the project locate the
secretsblock from project level build.gradle and follow the directions in adding your key to the app.- Note: Here is the documentation on what the Secrets Gradle plugin is for https://developers.google.com/maps/documentation/android-sdk/secrets-gradle-plugin
- Sign up for an account at https://www.yelp.com/developers
- Visit https://www.yelp.com/developers/documentation/v3/get_started
- Go to Manage App
- Copy API Key and in local.properties add value
YELP_API_KEYand add your API key there.
From Gradle version 6.8 and up, allProjects block is not required to list repositories. Instead list them in the project-level settings.gradle.kts. If attempt to add an allProjects block in your gradle file. Gradle will throw an error if dependencyResolutionManagement is present
in the project-level settings.gradle.kts.