Skip to content

Commit 710c6ee

Browse files
authored
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
1 parent 4fef493 commit 710c6ee

File tree

20 files changed

+67
-50
lines changed

20 files changed

+67
-50
lines changed

ApiDemos/java/app/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,11 +57,13 @@ dependencies {
5757
}
5858

5959
secrets {
60-
// Optionally specify a different file name containing your secrets.
61-
// The plugin defaults to "local.properties"
60+
// To add your Maps API key to this project:
61+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
62+
// 2. Add this line, where YOUR_API_KEY is your API key:
63+
// MAPS_API_KEY=YOUR_API_KEY
6264
propertiesFileName = "secrets.properties"
6365

6466
// A properties file containing default secret values. This file can be
6567
// checked in version control.
6668
defaultPropertiesFileName = "local.defaults.properties"
67-
}
69+
}

ApiDemos/kotlin/app/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,10 @@ dependencies {
7171
}
7272

7373
secrets {
74-
// Optionally specify a different file name containing your secrets.
75-
// The plugin defaults to "local.properties"
74+
// To add your Maps API key to this project:
75+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
76+
// 2. Add this line, where YOUR_API_KEY is your API key:
77+
// MAPS_API_KEY=YOUR_API_KEY
7678
propertiesFileName = "secrets.properties"
7779

7880
// A properties file containing default secret values. This file can be

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
![GitHub contributors](https://img.shields.io/github/contributors/googlemaps/android-samples)
2-
![Apache-2.0](https://img.shields.io/badge/license-Apache-blue)
2+
![Apache-2.0](https://img.shields.io/badge/license-Apache-blue)
33
[![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)
44
[![Discord](https://img.shields.io/discord/676948200904589322)](https://discord.gg/hYsWbmk)
55

@@ -27,7 +27,7 @@ Pre-requisites
2727

2828
* See each sample for pre-requisites.
2929
* All require up-to-date versions of the Android build tools and the Android support repository.
30-
* 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.
30+
* 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.
3131

3232
Getting Started
3333
---------------

WearOS/README.md

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
Wear OS Sample
22
===================================
33

4-
This sample uses the [Google Maps Android API v2](https://developers.google.com/maps/documentation/android/)
4+
This sample uses the [Google Maps SDK for Android](https://developers.google.com/maps/documentation/android-sdk/wear)
55
to display a map on Wear OS. It shows the basic setup required for a
66
gradle-based Android Studio project that [supports ambient mode](https://developer.android.com/training/wearables/apps/always-on.html).
77

@@ -21,14 +21,21 @@ First download the samples by cloning this repository or downloading an archived
2121
snapshot. (See the options at the top of the page.)
2222

2323
In Android Studio, use the "Import non-Android Studio project" or
24-
"Import Project" option. Next select the ApiDemos/ directory that you downloaded
24+
"Import Project" option. Next select the `WearOS/` directory that you downloaded
2525
from this repository.
2626
If prompted for a gradle configuration accept the default settings.
2727

2828
Alternatively use the "gradlew build" command to build the project directly.
2929

30-
Add your API key to the `local.properties` file and call it `GOOGLE_MAPS_API_KEY`.
31-
See the [quick guide to getting an API key](https://developers.google.com/maps/documentation/android-api/signup).
30+
See the [Get an API key](https://developers.google.com/maps/documentation/android-sdk/get-api-key) guide to get an API key.
31+
32+
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.
33+
If the `secrets.properties` file does not exist, create it in the same folder as the `local.properties` file.
34+
35+
```
36+
MAPS_API_KEY=YOUR_API_KEY
37+
```
38+
3239

3340
Support
3441
-------
@@ -49,4 +56,4 @@ CONTRIBUTING.md.
4956
License
5057
-------
5158

52-
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.
59+
Please refer to the [LICENSE](https://github.com/googlemaps/android-samples/blob/main/LICENSE) at the root of this repo.

WearOS/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
*/
1616

1717
plugins {
18-
id 'com.android.application' version '8.5.0' apply false
18+
id 'com.android.application' version '8.5.2' apply false
1919
id 'com.google.android.libraries.mapsplatform.secrets-gradle-plugin' version '2.0.1' apply false
2020
id 'org.jetbrains.kotlin.android' version '2.0.0' apply false
21-
}
21+
}

docs/GET_AN_API_KEY.md

Lines changed: 0 additions & 8 deletions
This file was deleted.

snippets/app-compose/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ dependencies {
6363
// [END maps_android_compose_dependency]
6464

6565
secrets {
66-
// Optionally specify a different file name containing your secrets.
67-
// The plugin defaults to "local.properties"
66+
// To add your Maps API key to this project:
67+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
68+
// 2. Add this line, where YOUR_API_KEY is your API key:
69+
// MAPS_API_KEY=YOUR_API_KEY
6870
propertiesFileName = "secrets.properties"
6971

7072
// A properties file containing default secret values. This file can be
7173
// checked in version control.
7274
defaultPropertiesFileName = 'local.defaults.properties'
73-
}
75+
}

snippets/app-ktx/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,13 @@ dependencies {
5454
// [END maps_android_ktx_install_snippet]
5555

5656
secrets {
57-
// Optionally specify a different file name containing your secrets.
58-
// The plugin defaults to "local.properties"
57+
// To add your Maps API key to this project:
58+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
59+
// 2. Add this line, where YOUR_API_KEY is your API key:
60+
// MAPS_API_KEY=YOUR_API_KEY
5961
propertiesFileName = "secrets.properties"
6062

6163
// A properties file containing default secret values. This file can be
6264
// checked in version control.
6365
defaultPropertiesFileName = 'local.defaults.properties'
64-
}
66+
}

snippets/app-places-ktx/build.gradle

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,10 @@ dependencies {
5454
// [END places_android_ktx_install_snippet]
5555

5656
secrets {
57-
// Optionally specify a different file name containing your secrets.
58-
// The plugin defaults to "local.properties"
57+
// To add your Maps API key to this project:
58+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
59+
// 2. Add this line, where YOUR_API_KEY is your API key:
60+
// MAPS_API_KEY=YOUR_API_KEY
5961
propertiesFileName = "secrets.properties"
6062

6163
// A properties file containing default secret values. This file can be

snippets/app-rx/build.gradle

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,11 +63,13 @@ dependencies {
6363
// [END maps_android_maps_rx_install]
6464

6565
secrets {
66-
// Optionally specify a different file name containing your secrets.
67-
// The plugin defaults to "local.properties"
66+
// To add your Maps API key to this project:
67+
// 1. If the secrets.properties file does not exist, create it in the same folder as the local.properties file.
68+
// 2. Add this line, where YOUR_API_KEY is your API key:
69+
// MAPS_API_KEY=YOUR_API_KEY
6870
propertiesFileName = "secrets.properties"
6971

7072
// A properties file containing default secret values. This file can be
7173
// checked in version control.
7274
defaultPropertiesFileName = 'local.defaults.properties'
73-
}
75+
}

0 commit comments

Comments
 (0)