I decided to build a paid version of my free Android application.
The paid version has some extra features. How do I manage both versions?
- Is it possible to keep them based on the same source code?
- If an application requires unique package name, how do I force paid application to replace free version?
- What about db, preferences and other privately stored stuff, how to share them without exposing all data to the rest of the world?
Any advice that will help to manage both projects,
but not answers the above questions directly, is appreciated as well.
There are several approaches:
- Put the core of your app in a library project, and create two other projects one for the paid, and one for the free version of the app. An upgrade to the paid version means the user has to uninstall the free version, and looses all the data.
This is the “classical” approach.
- Let the user make an in-app payment. The user keeps all database and settings, and you have to maintain only one app.
This option requires extra modules to be included in your app, and extra logic.
- Make another dummy/empty app, this is a paid app. The existance of this app means the user has a paid version. The user keeps on using the orginal/free app.
You can simply check by using the PackageManager to see if the paid app is downloaded.
The user keeps all database and settings, and you have to maintain only one app. Ok, there are two apps, but the second can be really small and simple.
You don’t have to include additional libraries/code to make an in-app payment. You can also have all your apps upgraded to the ‘pro’ version with one purchase.
I don’t know if all users understand this pattern. For the developper, this can be achieved with minimal work, and the users keep all their settings while upgrading.
I think it’s possible and recommended to keep them in same source
code. Otherwise you have to support two versions of app instead of
If you have only one app therefore you have only one package name.
Create a class responsible for app features availability in current license state (free or paid). This class should store information about license state (free, paid, maybe you will deside to add subscription mode in future in which paid version can expire after some period). Features of your app available only in paid verion shoud check current license state. You can also change app GUI depending of license state. For example hide GUI of paid features, show “Buy” button or ads, etc.
And also if you have only one app that can be free or paid you don’t have to share any internal app data between paid and free versions.