android samples - MapWithMarker
MagicTheFroot opened this issue · 1 comments
URL: https://developers.google.com/maps/documentation/android-sdk/map-with-marker#manifest
it says to add the API key to the "gradle.properties" file of the project, which is wrong.
It should go, where the README.md file of the "android-samples" says it should go, into
.../android-samples/secure.properties
as
MAPS_API_KEY=
because in app/build.gradle the script is looking there for the key:
--- 8< ---
if (file("../../../../secure.properties").exists()) {
...
resValue "string", "maps_api_key", (secureProps.getProperty("MAPS_API_KEY") ?: "")
--- >8 ---
Please update the website.
@MagicTheFroot both strategies will work and the recommendation on the documentation page is technically correct. However, the recommendation on the README of this repo and on this page https://developers.google.com/maps/documentation/android-sdk/get-api-key#add_key are more secure since gradle.properties
is typically checked into source code whereas secure.properties
is a file you should add in your .gitignore
file. The tutorial should still be updated though to make the recommendations consistent—I'll open an issue in our documentation bug tracker for this and close this issue.
FYI, you can report any issues directly on the documentation page using the "Send feedback" button.