Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android build flags?

I'm building an android app with 2 versions of paid and free. Basically I have a library project with all the logic and 2 skeleton projects for each version. Now I need some kind of build flags to distinguish between the versions. Is this possible?

like image 711
Alex1987 Avatar asked Aug 11 '11 09:08

Alex1987


1 Answers

You actually do not need build flag for that. Here is how you can achieve this:

  1. In your Library Project define resource: <bool name="type.free">true</bool>
  2. In your application that is supposed to be free: <bool name="type.free">true</bool>
  3. In your application that is supposed to be paid: <bool name="type.free">false</bool>

And then at any point in your Library Project you can check the value of Boolean resource and decide what you need to do. Of cource, you'll need access to Context object for this.

like image 116
inazaruk Avatar answered Sep 23 '22 23:09

inazaruk