mirror of
https://github.com/googlemaps/android-samples.git
synced 2025-12-08 18:02:20 +00:00
chore: update all instructions to use secrets.properties (#1755)
* chore: update WearOS readme * chore: update WearOS AGP version * chore: remove outdated API key instructions * chore: update comments in build.gradle
This commit is contained in:
parent
4fef493e6f
commit
710c6ee148
@ -57,11 +57,13 @@ dependencies {
|
||||
}
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = "local.defaults.properties"
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,10 @@ dependencies {
|
||||
}
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||

|
||||

|
||||

|
||||
[](https://github.com/googlemaps/android-samples/actions?query=workflow%3A%22Build+demos%22)
|
||||
[](https://discord.gg/hYsWbmk)
|
||||
|
||||
@ -27,7 +27,7 @@ Pre-requisites
|
||||
|
||||
* See each sample for pre-requisites.
|
||||
* All require up-to-date versions of the Android build tools and the Android support repository.
|
||||
* The demo apps require that you add your own Google Maps API key. See [Get an API Key](docs/GET_AN_API_KEY.md) docs for more instructions.
|
||||
* The demo apps require that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) docs for more instructions.
|
||||
|
||||
Getting Started
|
||||
---------------
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
Wear OS Sample
|
||||
===================================
|
||||
|
||||
This sample uses the [Google Maps Android API v2](https://developers.google.com/maps/documentation/android/)
|
||||
This sample uses the [Google Maps SDK for Android](https://developers.google.com/maps/documentation/android-sdk/wear)
|
||||
to display a map on Wear OS. It shows the basic setup required for a
|
||||
gradle-based Android Studio project that [supports ambient mode](https://developer.android.com/training/wearables/apps/always-on.html).
|
||||
|
||||
@ -21,14 +21,21 @@ First download the samples by cloning this repository or downloading an archived
|
||||
snapshot. (See the options at the top of the page.)
|
||||
|
||||
In Android Studio, use the "Import non-Android Studio project" or
|
||||
"Import Project" option. Next select the ApiDemos/ directory that you downloaded
|
||||
"Import Project" option. Next select the `WearOS/` directory that you downloaded
|
||||
from this repository.
|
||||
If prompted for a gradle configuration accept the default settings.
|
||||
|
||||
Alternatively use the "gradlew build" command to build the project directly.
|
||||
|
||||
Add your API key to the `local.properties` file and call it `GOOGLE_MAPS_API_KEY`.
|
||||
See the [quick guide to getting an API key](https://developers.google.com/maps/documentation/android-api/signup).
|
||||
See the [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) guide to get an API key.
|
||||
|
||||
Open the `secrets.properties` file in your top-level directory, and then add the following code. Replace YOUR_API_KEY with your API key. Store your key in this file because secrets.properties is excluded from being checked into a version control system.
|
||||
If the `secrets.properties` file does not exist, create it in the same folder as the `local.properties` file.
|
||||
|
||||
```
|
||||
MAPS_API_KEY=YOUR_API_KEY
|
||||
```
|
||||
|
||||
|
||||
Support
|
||||
-------
|
||||
@ -49,4 +56,4 @@ CONTRIBUTING.md.
|
||||
License
|
||||
-------
|
||||
|
||||
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.
|
||||
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.
|
||||
|
||||
@ -15,7 +15,7 @@
|
||||
*/
|
||||
|
||||
plugins {
|
||||
id 'com.android.application' version '8.5.0' apply false
|
||||
id 'com.android.application' version '8.5.2' apply false
|
||||
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
|
||||
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,8 +0,0 @@
|
||||
# Getting an API Key
|
||||
|
||||
The demos found in this repository require an API key. To create and use an API key:
|
||||
|
||||
1. [Get a Maps API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key)
|
||||
1. Open the file in the root directory of the sample called `local.properties` (by default, this file is **NOT** under version control)
|
||||
1. Add a single line to `local.properties` that looks like `MAPS_API_KEY=YOUR_API_KEY`, where `YOUR_API_KEY` is the API key you obtained in the first step
|
||||
1. Build and run
|
||||
@ -63,11 +63,13 @@ dependencies {
|
||||
// [END maps_android_compose_dependency]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = 'local.defaults.properties'
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,11 +54,13 @@ dependencies {
|
||||
// [END maps_android_ktx_install_snippet]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = 'local.defaults.properties'
|
||||
}
|
||||
}
|
||||
|
||||
@ -54,8 +54,10 @@ dependencies {
|
||||
// [END places_android_ktx_install_snippet]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
|
||||
@ -63,11 +63,13 @@ dependencies {
|
||||
// [END maps_android_maps_rx_install]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = 'local.defaults.properties'
|
||||
}
|
||||
}
|
||||
|
||||
@ -52,11 +52,13 @@ dependencies {
|
||||
// [END maps_android_utils_ktx_install_snippet]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = 'local.defaults.properties'
|
||||
}
|
||||
}
|
||||
|
||||
@ -57,11 +57,13 @@ dependencies {
|
||||
// [END maps_android_utils_install_snippet]
|
||||
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
// checked in version control.
|
||||
defaultPropertiesFileName = 'local.defaults.properties'
|
||||
}
|
||||
}
|
||||
|
||||
@ -71,8 +71,10 @@ dependencies {
|
||||
|
||||
// [START maps_android_secrets_gradle_plugin_config]
|
||||
secrets {
|
||||
// Optionally specify a different file name containing your secrets.
|
||||
// The plugin defaults to "local.properties"
|
||||
// To add your Maps API key to this project:
|
||||
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
|
||||
// 2. Add this line, where YOUR_API_KEY is your API key:
|
||||
// MAPS_API_KEY=YOUR_API_KEY
|
||||
propertiesFileName = "secrets.properties"
|
||||
|
||||
// A properties file containing default secret values. This file can be
|
||||
|
||||
@ -26,7 +26,7 @@ This sample uses the Gradle build system.
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -19,12 +19,12 @@ This sample uses the Gradle build system.
|
||||
|
||||
1. Download the samples by cloning this repository or downloading an archived
|
||||
snapshot. (See the options at the top of the page.)
|
||||
1. In Android Studio, use "Open an existing Android Studio project". Next select the
|
||||
1. In Android Studio, use "Open an existing Android Studio project". Next select the
|
||||
`tutorials/java/MapWithMarker` directory that you downloaded
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -23,7 +23,7 @@ This sample uses the Gradle build system.
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -23,7 +23,7 @@ This sample uses the Gradle build system.
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the "gradlew build" command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -23,7 +23,7 @@ This sample uses the Gradle build system.
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -20,12 +20,12 @@ This sample uses the Gradle build system.
|
||||
|
||||
1. Download the samples by cloning this repository or downloading an archived
|
||||
snapshot. (See the options at the top of the page.)
|
||||
1. In Android Studio, use "Open an existing Android Studio project". Next select the
|
||||
1. In Android Studio, use "Open an existing Android Studio project". Next select the
|
||||
`tutorials/kotlin/MapWithMarker` directory that you downloaded
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
@ -23,7 +23,7 @@ This sample uses the Gradle build system.
|
||||
1. If prompted for a gradle configuration, accept the default settings.
|
||||
Alternatively use the `gradlew build` command to build the project directly.
|
||||
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API Key](../../../docs/GET_AN_API_KEY.md) for more instructions.
|
||||
This demo app requires that you add your own Google Maps API key. See [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) for more instructions.
|
||||
|
||||
Support
|
||||
-------
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user