Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 840
Addev Avatar asked Dec 12 '25 15:12

Addev


1 Answers

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.

like image 197
aroth Avatar answered Dec 14 '25 04:12

aroth



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!