views:

247

answers:

3

I want to create a PRO version of my application for Android and was wondering how to structure my repository.

For know I have a trunk and feature branches. I'd like to put a pro version in another branch but maybe there is a better way? For example, maybe I should create two branches - one for free version, the other for pro?

Pro version will have additional features and will be ads-free, so eg. I don't want to include AdMob libraries in the pro version.

Do you have any experience or suggestions as to what would be the best way to structure the repository in this case?

EDIT: I think I've found the best solution (for my app) in this thread: http://groups.google.com/group/android-developers/browse_thread/thread/4ad3d67f735f16d7/948b4f9eee2490a3

The trick discussed there is about having another application that only serves the purpose of unlocking PRO functionality in the actual application. The unlocking app is paid in the market and the actual app merely checks for the existence of it on the device.

+6  A: 

I would suggest not maintaining two branches, but have either runtime or compile time switches to disable the PRO functionality for the free version. You could even remove not required DLL's when building.

Maintaining two branches means fixing problems in two places, which will become more of a problem as the branches inevitably diverge.

Paddy
Seems reasonable. I also found a suggestion to provide an "unlocker" app which is paid and just needs to be installed on the device if one wants to use pro-features.
Immortal
Please share info about the "unlocker" app :)
alexanderblom
@Immortal That is what Touiteur does, and while I’ve no idea how it is implemented, it is simple and unobtrusive.
jleedev
It's going to be simplest for you and handiest for any clients that wish to upgrade.
Paddy
@illojal I've updated the question to include information about the "unlocker app" approach.
Immortal
Thanks! That is helpful.
alexanderblom
+2  A: 

Have a single version with public static final boolean IS_PRO that would determine free/pro behavior.

EDIT:
The package thing. Say, all your classes reside under com.myapp.android.free.
Then, in AndroidManifest.xml you declare package="com.myapp.android" for the paid version and package="com.myapp.android.free" for the free one.
If you use full names for activities, services, etc., you won't have to change anything else.

I wouldn't bother removing unused libs from the paid version. If you do, you'll have to do this manually.

alex
Yeah, as if I didn't think of that :/ What about publishing the applicaton on Android Market? Packages must be unique. What about not including AdMob jar in a pro version?
Immortal
Thanks for this answer. I think I'll go with the 'unlocker app' approach.
Immortal
+3  A: 

I know you have already made your decision, but I have another suggestion that might help others.

I use git for my repository. Creating and maintaining branches is very easy. I have my master "pro" repository, and a "free" branch. Whenever I make all code changes to the master. My "free" branch only differs by whatever changes trigger the "free" behavior. Whenever I'm done making changes to the code, I commit it to the master branch, then switch over to the free branch and use the "rebase" command to catch it up with the master.

It rolls back the change that makes it behave as the "free" version, applies the changes I made to master, then re-applies the "free" changes.

I don't have to maintain two versions. I don't have to remember to toggle some switch, or make the same changes back and forth. It's pretty slick, and I like it better than a second app that triggers the pro behavior because I can strip out libraries that aren't needed for the version in question.

BenTobin
Didn't think of this myself (I'm a Subversion user, now started to use git on svn repos). Thanks for the tip, I'll try it out myself (though I probably have to make a real git repo server (I want those backups) ...)
MrSnowflake
Very interesting. I'll look into this. Thanks.
Immortal