Just started playing with Android and I\'m trying to create an app that has free and paid version. I\'m new to Java as well but I\'ve managed to create a simple working applicat
Your code works, but I'm not sure storing your paid/free flag in your manifest is the best solution if you are using the same apk to have both free and paid (unlock) functionality. Instead I would do this by adding a method in the library project which allows any project to set a flag on whether the app is free or paid.
ex in library project:
void setAppPurchasedMode(boolean purchased)
{
appPurchased = mode;
}
and in your library, you can check vs this flag:
if (appPurchased)
// show unlocked content
So in your main project, if the app has been paid for:
Library.setAppPurchasedMode(true);
OK I managed to solve this. In the Application Manifest, I simply set the android:label property and referenced this using the code below.
In Manifest:
android:label="My Free App"
To reference this
//Are we using free or pro version?
if (this.getApplication().getApplicationInfo().loadLabel(this.getPackageManager()).toString().equals("My Free App"))
{
freeVersion = true;
} else {
freeVersion = false;
}