Today we are gonna talk about how to integrate maps into your Jetpack Compose app. For that, we are gonna use the Maps Compose Library.
“The Maps Compose library contains composable functions and data types that let you perform many common tasks.” According to Maps Compose Library official documentation
First, you need to obtain an API key by following the instructions on this page:
Using API Keys | Maps SDK for Android | Google Developers
This topic describes how to create an API key for the Maps SDK for Android, add it to your app, and secure the app by…
Next, let’s include needed dependencies:
implementation 'com.google.maps.android:maps-compose:2.7.2' implementation 'com.google.android.gms:play-services-maps:18.1.0'
Note: Check if there is a newer version of these dependencies.
Next, in your manifest file, add the following metadata:
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${MAPS_API_KEY}" />
Now we are ready to implement maps in our code!