Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Maps Api Key code in Github

I want to publish an Android App in Github. The problem is that I work with Google Maps Api, and I have the api key within the project.

What is you recommendation about that? Just erase the api key from the code?

Thanks!

like image 502
Emmanuel Arias Avatar asked Apr 06 '17 01:04

Emmanuel Arias


1 Answers

You could erase the API key from the code but it would be a struggle to keep removing it from the code when pushing to the repository.

I would create a new value resource file called keys.xml and move all your API keys there. Then add keys.xml to the gitignore so it is never pushed. In the AndroidManifest you simply point to the string resource.

In your repository's README you could instruct developers how to add their own API keys.

like image 56
Brianvdb Avatar answered Sep 30 '22 21:09

Brianvdb