4

I recently finished an android application that I put on the play store. I wish to put it on github / bitbucket in case anyone is interested by it.

There is an ad banner, so I stored my public key in the strings.xml file. How should I handle it ?

I already added a "flavour" in order to be able to generate an apk without ads.

Additionally what kind of similar precautions should I take before releasing it in the wild ?

Jaxian
  • 1,146
  • 7
  • 14
vincenth
  • 1,732
  • 5
  • 19
  • 27
  • This would make a great question on [Open Source Stack Exchange](//opensource.stackexchange.com) as well. – Zizouz212 Jul 09 '16 at 19:47

1 Answers1

3

You should not upload any API keys or alike to any GitHub repository since it's going to be against most of the Terms and Conditions of a lot of providers, including GitHub itself I think.

To solve this, you could put a placeholder in the place where the people should put their own API key and upload that file to the repository, for example:

<resources>
    <string name="GOOGLE_MAPS_API_KEY">PUT YOUR API KEY HERE</string>
</resources>

You should also start thinking about licensing your code.

Open source licenses are licenses that comply with the Open Source Definition — in brief, they allow software to be freely used, modified, and shared. To be approved by the Open Source Initiative (also known as the OSI), a license must go through the Open Source Initiative's license review process.

There are a lot of different licenses, including:

  • Apache License 2.0
  • BSD 3-Clause "New" or "Revised" license
  • BSD 2-Clause "Simplified" or "FreeBSD" license
  • GNU General Public License (GPL)
  • GNU Library or "Lesser" General Public License (LGPL)
  • MIT license
  • Mozilla Public License 2.0
  • Common Development and Distribution License
  • Eclipse Public License

Check out this link to see more about these licenses.


And, yes you can still benefit from your own ads using Open Source, as in the opensource.org website is mentioned:

Can Open Source software be used for commercial purposes?

Absolutely. All Open Source software can be used for commercial purpose; the Open Source Definition guarantees this. You can even sell Open Source software.

Evin1_
  • 12,292
  • 9
  • 45
  • 47
  • I thought about the placeholder, but if figured that I might I would have to replace it by the real value when building an update and that I might forget to remove it before commiting. Am I missing something there ? – vincenth Jul 04 '16 at 15:49
  • You can create a changelist in Android Studio, to let it know that you want to ignore certain files during commits. https://www.jetbrains.com/help/idea/2016.1/changelist.html – Evin1_ Jul 04 '16 at 15:53
  • If you still forget it you can http://stackoverflow.com/questions/927358/how-do-you-undo-the-last-commit – Evin1_ Jul 04 '16 at 15:54