I\'m building an app wit different build variant flavors. The flavors are \"Free\" and \"Paid\". I want to create some logic on my java classes which should only get trigger
I found best solution to get all values like APPLICATION_ID, BUILD_TYPE, FLAVOR, VERSION_CODE and VERSION_NAME.
Just write : Log.d("Application Id : ",BuildConfig.APPLICATION_ID); in your code. It will provide APPLICATION_ID of your flavor.
BuildConfig.java
public final class BuildConfig {
public static final boolean DEBUG = Boolean.parseBoolean("true");
public static final String APPLICATION_ID = "";
public static final String BUILD_TYPE = "debug";
public static final String FLAVOR = "";
public static final int VERSION_CODE = 1;
public static final String VERSION_NAME = "";
}
For more details you can refer this link : http://blog.brainattica.com/how-to-work-with-flavours-on-android/