title: Android - How To Get Flavor's ApplicationId
body: <p>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 triggered if the app is "Paid". Therefore I need a way to get the "applicationId" set during the gradle build process as shown below: </p>
  
  <p><strong>gradle.build</strong></p>
  
  <pre><code>    productFlavors {
      free {
          applicationId "com.example.free"
          resValue "string", "app_name", "Free App"
          versionName "1.0-free"
      }
      paid {
          applicationId "com.example.paid"
          resValue "string", "app_name", "Paid App"
          versionName "1.0-paid"
      }
  </code></pre>
  
  <p>Once I have the application ID I could do something like this:</p>
  
  <pre><code>    if(whateverpackageid.equals("paid")) {
        // Do something or trigger some premium functionality.
      } 
  </code></pre>
  
  <p>Am I correct to say that during the gradle build process the "applicationId" eventually becomes the "package name" once the app has been compiled? If so what is the best way to get either the "application ID" or "package name" so that I can implement some flavor dependent logic in my java files? </p>