Addev
Addev

Reputation: 32253

Maintain pro and free version in Android

I have noticed there is a lot of apps in the market with 2 versions. One free and one paid with extended options and adfree typically.

Im considering make something similar with a project but, whats the best technique for maintain both versions? I suppouse using 2 android projects in eclipse and manually change them is expensive and error-prone

Thanks in advance

Upvotes: 3

Views: 665

Answers (2)

Phil
Phil

Reputation: 36289

You can have a constant value hardcoded in your app, such as boolean isPro. if (this.isPro), you can allow other features or not show adds. Then, when you are ready to upload your apps to the android Market, just create two - one with isPro assigned to false, the other to true.

Upvotes: 0

aroth
aroth

Reputation: 54846

Make one version of the app, and use properties that you read from some bundled resource file to determine whether it's the free version or the paid version. For instance, when building the paid version, you just set something like:

com.myapp.version=paid

...and for the free app maybe something like:

com.myapp.version=free

And then as part of your initialization code you could fetch this property from the file/resource, and set it as a system property. And then the rest of you code can just do:

if ("paid".equals(System.getProperty("com.myapp.version"))) {
    //allow access to paid functionality
}
else {
    //nag the user to get the paid version
}

So instead of two separate projects, you have a single project and a single codebase that you use to build two different artifacts.

Upvotes: 3

Related Questions