Search code examples
androidopen-source

How to open source an android application


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 ?


Solution

  • 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.