I use one among many options to store my API keys in the computer/keychain rather than directly in the cloud-backed-up project code (namely gradle-credentials-plugin ). What I'd like is to be able to manage Google Maps keys in a similar way, but they're used in a different file (Manage Google Maps API Key with Gradle in Android Studio).
If anyone has a simple (or intricate, but reliable) option for me to dig into, I'd be grateful!
Go to the Google Maps Platform > Credentials page. On the Credentials page, click Create credentials > API key. The API key created dialog displays your newly created API key. Click Close.
In order to embed a Google Map iframe without api key add a Google Map widget from the left side panel. Then open it and add the address. This way you can embed Google Map without api key via Elementor.
To delete an API key: Go to the Credentials page. Select the API key you want to delete. Select the Delete button near the top of the page.
Yes you need to setup a billing account, there is no way around it these days.
You can use manifestPlaceholders to inject the string from your build.gradle
.
local.properties
google.maps_api_key=SECRET_KEY
.gitignore
:local.properties
AndroidManifest.xml
. Using withInputStream()
ensures the InputStream
is closed automatically.android{
defaultConfig {
// Load credentials.
def properties = new Properties()
file("../local.properties").withInputStream { properties.load(it) }
// Share the key with your `AndroidManifest.xml`
manifestPlaceholders = [ googleMapsApiKey:"${properties.getProperty('google.maps_api_key')}"]
AndroidManifest.xml
:<application>
<meta-data
android:name="com.google.android.geo.API_KEY"
android:value="${googleMapsApiKey}" />
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With