<p>Before you can start using the In-app Billing service, you'll need to add the library that contains the In-app Billing Version 3 API to your Android project. You also need to set the permissions for your application to communicate with Google Play. In addition, you'll need to establish a connection between your application and Google Play. You should also verify that the In-app Billing API version that you are using in your application is supported by Google Play.</p>
<h2 id="GetSample">Download the Sample Application</h2>
<p>In this training class, you will use a reference implementation for the In-app Billing Version 3 API called the {@code TrivialDrive} sample application. The sample includes convenience classes to quickly set up the In-app Billing service, marshal and unmarshal data types, and handle In-app Billing requests from the main thread of your application.</p>
<p>To download the sample application:</p>
<ol>
<li>Open the <a href="{@docRoot}tools/help/sdk-manager.html">Android SDK Manager</a>.</li>
<li>In the SDK Manager, expand the {@code Extras} section.</li>
<li>Select <strong>Google Play Billing Library</strong>.</li>
<li>Click <strong>Install packages</strong> to complete the download.</li>
<li>Open Android Studio and then close any open projects until you are
presented with the welcome screen.</li>
<li>Choose <strong>Import an Android code sample</strong> from the
<strong>Quick Start</strong> list on the right side the window.</li>
<li>Type {@code Trivial Drive} into the search bar and select the
<strong>Trivial Drive</strong> sample.</li>
<li>Follow the rest of the instructions in the <strong>Import Sample</strong>
wizard to import the sample to a directory of your choosing. The sample code
is in the <strong>TrivialDrive</strong> subdirectory of the repository.</li>
</ol>
<p>The sample files will be installed to {@code <sdk>/extras/google/play_billing/}.</p>
<p>Alternatively, you can use {@code git} to manually clone
<h2 id="AddToDevConsole">Add Your Application to the Developer Console</h2>
<p>The Google Play Developer Console is where you publish your In-app Billing application and manage the various digital goods that are available for purchase from your application. When you create a new application entry in the Developer Console, it automatically generates a public license key for your application. You will need this key to establish a trusted connection from your application to the Google Play servers. You only need to generate this key once per application, and don’t need to repeat these steps when you update the APK file for your application.</p>