I have an Android app project that contains all of my code. I've made this "app" a Library project as defined here at android.developer.com..
Consequently, I have made two new Android projects which utilize this library project. The new package names for each of the new projects are:
com.myapps.freeapp
com.myapps.paidapp
As you can probably see, I am trying to publish free and paid versions of the app.
What is the best way to tell the library project whether the installed app is the free version or paid version?
The "paid" and "free" informations are dependant on each application -- and the library doesn't know such informations.
If you have some specific code that depends on those applications (i.e. code to check for the licence, for example), it should be in the specific applications, and not in the part that's common to both.
This is from my blog post that describes how to build a free / paid version using a library project.
Generally, you'll create three projects; a free project, a paid project and a library project.
You'll then create a Build.java file in your library project such as this:
Now, you'll create an build.xml resource in each of your projects:
[library]/resources/values/build.xml:
[free]/resources/values/build.xml:
[paid]/resources/values/build.xml:
You will then be able to check for the version at run time:
The blog post details the exact steps necessary to create the projects from scratch at the Linux command line.