Google Maps Api Key code in Gituba

I want to publish my Android app to Github. The problem is that I am working with Google Maps Api and I have an api key in the project.

What do you recommend? Just remove the api key from the code?

Thank!

+3


source to share


1 answer


You can remove the API key from the code, but it would be difficult to keep 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. Then add keys.xml to gitignore so it never gets pushed. In AndroidManifest, you simply point to a string resource.



In your README repository, you can tell developers how to add their own API keys.

+2


source







All Articles