Skip to content

Commit

Permalink
chore: update all instructions to use secrets.properties (#1755)
Browse files Browse the repository at this point in the history
* chore: update WearOS readme

* chore: update WearOS AGP version

* chore: remove outdated API key instructions

* chore: update comments in build.gradle
  • Loading branch information
wangela authored Aug 16, 2024
1 parent 4fef493 commit 710c6ee
Show file tree
Hide file tree
Showing 20 changed files with 67 additions and 50 deletions.
8 changes: 5 additions & 3 deletions ApiDemos/java/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
6 changes: 4 additions & 2 deletions ApiDemos/kotlin/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/android-samples)
![Apache-2.0](https://img.shields.io/badge/license-Apache-blue)
![Apache-2.0](https://img.shields.io/badge/license-Apache-blue)
[![Build demos](https://github.com/googlemaps/android-samples/workflows/Build%20demos/badge.svg)](https://github.com/googlemaps/android-samples/actions?query=workflow%3A%22Build+demos%22)
[![Discord](https://img.shields.io/discord/676948200904589322)](https://discord.gg/hYsWbmk)

Expand Down Expand Up @@ -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
---------------
Expand Down
17 changes: 12 additions & 5 deletions WearOS/README.md
Original file line number Diff line number Diff line change
@@ -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).

Expand All @@ -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
-------
Expand All @@ -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.
4 changes: 2 additions & 2 deletions WearOS/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
8 changes: 0 additions & 8 deletions docs/GET_AN_API_KEY.md

This file was deleted.

8 changes: 5 additions & 3 deletions snippets/app-compose/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
8 changes: 5 additions & 3 deletions snippets/app-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
6 changes: 4 additions & 2 deletions snippets/app-places-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 5 additions & 3 deletions snippets/app-rx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
8 changes: 5 additions & 3 deletions snippets/app-utils-ktx/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
8 changes: 5 additions & 3 deletions snippets/app-utils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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'
}
}
6 changes: 4 additions & 2 deletions snippets/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tutorials/java/CurrentPlaceDetailsOnMap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
4 changes: 2 additions & 2 deletions tutorials/java/MapWithMarker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
2 changes: 1 addition & 1 deletion tutorials/java/Polygons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
2 changes: 1 addition & 1 deletion tutorials/java/StyledMap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
2 changes: 1 addition & 1 deletion tutorials/kotlin/CurrentPlaceDetailsOnMap/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
4 changes: 2 additions & 2 deletions tutorials/kotlin/MapWithMarker/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down
2 changes: 1 addition & 1 deletion tutorials/kotlin/Polygons/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
-------
Expand Down

0 comments on commit 710c6ee

Please sign in to comment.