You can use if-else constructs, as the compiler will leave out any
never reached peaces of code.

Define a var to check against:
public static final boolean FREE_VERSION = false;

and when you want to check:
if (FREE_VERSION) {
  // This code won't end up in the final binary
} else {
  // Only this will be there...
}

On Apr 20, 4:47 am, Edward  Falk <[email protected]> wrote:
> What is the best way to release two versions of an application?  E.g.
> a free version with limited features, and a paid version with the full
> feature set.
>
> #ifdef would be the ideal way to do this, but Java doesn't support it.
>
> Could I do something like:
>
>   try {
>     import com.foo.myapplication.ExtraFeatures;
>   } catch (Exception e) {
>     // ignore it, this must be the free version
>   }
>
> ?
>
> I could manage with this kind of construct, although #ifdef really
> would be ideal.
>
> Anybody?  How have other developers approached this problem?
>
>   -ed falk
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to