Home | History | Annotate | Download | only in licensing
      1 page.title=Setting Up for Licensing
      2 parent.title=Application Licensing
      3 parent.link=index.html
      4 @jd:body
      5 
      6 
      7 <div id="qv-wrapper">
      8 <div id="qv">
      9   
     10   <h2>In this document</h2>
     11   <ol>
     12   <li><a href="#account">Setting Up a Publisher Account</a></li>
     13   <li><a href="#dev-setup">Setting Up the Development Environment</a>
     14     <ol>
     15       <li><a href="#runtime-setup">Setting up the runtime environment</a></li>
     16       <li><a href="#download-lvl">Downloading the LVL</a></li>
     17       <li><a href="#lvl-setup">Setting Up the Licensing Verification Library</a></li>
     18       <li><a href="#add-library">Including the LVL library project sources in your
     19 application</a></li>
     20     </ol>
     21   </li>
     22   <li><a href="#test-env">Setting Up the Testing Environment</a>
     23     <ol>
     24       <li><a href="#test-response">Setting test responses for license checks</a></li>
     25       <li><a href="#test-acct-setup">Setting up test accounts</a></li>
     26       <li><a href="#acct-signin">Signing in to an authorized account in the runtime
     27 environment</a></li>
     28     </ol>
     29   </li>
     30 </ol>
     31 </div>
     32 </div>
     33 
     34 <p>Before you start adding license verification to your application, you need to set up your Google
     35 Play publishing account, your development environment, and any test accounts required to verify
     36 your implementation.</p>
     37 
     38 
     39 <h2 id="account">Setting Up a Publisher Account</h2>
     40 
     41 <p>If you don't already have a publisher account for Google Play, you need to register for one
     42 using your Google account and agree to the Google Play terms of service.</p>
     43 
     44 <p>For more information, see <a
     45 href="{@docRoot}distribute/googleplay/publish/register.html">Get Started with Publishing</a>.</p>
     46 
     47 <p>If you already have a publisher account on Google Play, use your
     48 Developer Console to set up licensing.</p>
     49 
     50 <p>Using the Google Play Developer Console, you can:</p>
     51 
     52 <ul>
     53 <li>Obtain an app-specific public key for licensing</li>
     54 <li>Debug and test an application's licensing implementation, prior to
     55 publishing the application</li>
     56 <li>Publish the applications to which you have added licensing support</li>
     57 </ul>
     58 
     59 <h4>Administrative settings for licensing</h4>
     60 
     61 <p>You can manage several
     62 administrative controls for Google Play licensing in the Developer Console. The controls
     63 let you: </p>
     64 
     65 <ul>
     66 <li>Set up multiple "test accounts," identified by email address. The licensing
     67 server allows users signed in to test accounts on a device or emulator to send
     68 license checks and receive static test responses. You can set up accounts in the
     69 Account Details page of the Developer Console.</li>
     70 <li>Configure static test responses that the server sends, when it receives a
     71 license check for an application uploaded to the publisher account, from a user
     72 signed in to the publisher account or a test account. You can set test responses
     73 in the Account Details page of the Developer Console.</li>
     74 <li>Obtain the app's public key for licensing. When you are implementing
     75 licensing in an application, you must copy the public key string into the
     76 application. You can obtain the app's public key for licensing in the Services
     77 & APIs page (under All Applications).</li>
     78 </ul>
     79 
     80 <div style="width:640px;">
     81 <img src="{@docRoot}images/licensing_public_key.png" class="frame">
     82 <p class="img-caption"><strong>Figure
     83 2.</strong> An app's license key is available from the Services &amp; APIs page in
     84 the Developer Console.</p>
     85 </div>
     86 
     87 <p>For more information about how to work with test accounts and static test
     88 responses, see <a href="#test-env">Setting Up a Testing Environment</a>, below.
     89 
     90 
     91 <h2 id="dev-setup">Setting Up the Development Environment</h2>
     92 
     93 <p>Setting up your environment for licensing involves these tasks:</p>
     94 
     95 <ol>
     96 <li><a href="#runtime-setup">Setting up the runtime environment</a> for development</li>
     97 <li><a href="#download-lvl">Downloading the LVL</a> into your SDK </li>
     98 <li><a href="#lvl-setup">Setting up the Licensing Verification Library</a></li>
     99 <li><a href="#add-library">Including the LVL library project in your application</a></li>
    100 </ol>
    101 
    102 <p>The sections below describe these tasks. When you are done with setup,
    103 you can begin <a href="{@docRoot}google/play/licensing/adding-licensing.html">Adding
    104 Licensing to Your App</a>.</p>
    105 
    106 <p>To get started, you need to set up a proper runtime environment on which
    107 you can run, debug, and test your application's implementation of license
    108 checking and enforcement. </p>
    109 
    110 
    111 <h3 id="runtime-setup">Setting up the runtime environment</h3>
    112 
    113 <p>As described earlier, applications check licensing status not by contacting
    114 the licensing server directly, but by binding to a service provided by the
    115 Google Play application and initiating a license check request. The Google
    116 Play service then handles the direct communication with the licensing server
    117 and finally routes the response back to your application. To debug and test
    118 licensing in your application, you need to set up a runtime environment that
    119 includes the necessary Google Play service, so that your application is able
    120 to send license check requests to the licensing server. </p>
    121 
    122 <p>There are two types of runtime environment that you can use: </p>
    123 
    124 <ul>
    125 <li>An Android-powered device that includes the Google Play application, or</li>
    126 <li>An Android emulator running the Google APIs Add-on, API level 8 (release 2)
    127 or higher</li>
    128 </ul>
    129 
    130 <h4 id="runtime-device">Running on a device</h4>
    131 
    132 <p>To use an Android-powered device for
    133 debugging and testing licensing, the device must:</p>
    134 
    135 <ul>
    136 <li>Run a compatible version of Android 1.5 or later (API level
    137 3 or higher) platform, <em>and</em> </li>
    138 <li>Run a system image on which the Google Play client application
    139 is preinstalled. </li>
    140 </ul>
    141 
    142 <p>If Google Play is not preinstalled in the system image, your application won't
    143 be able to communicate with the Google Play licensing server. </p>
    144 
    145 <p>For general information about how to set up a device for use in developing
    146 Android applications, see <a
    147 href="{@docRoot}tools/device.html">Using Hardware Devices</a>.</p>
    148 
    149 <h4 id="runtime-emulator">Running on an Android emulator</h4>
    150 
    151 <p>If you don't have a device available, you can use an Android emulator for debugging and testing
    152 licensing.</p>
    153 
    154 <p>Because the Android platforms provided in the Android SDK <em>do
    155 not</em> include Google Play, you need to download the Google APIs Add-On
    156 platform, API level 8 (or higher), from the SDK repository. After downloading
    157 the add-on, you need to create an AVD configuration that uses that system image.
    158 </p>
    159 
    160 <p>The Google APIs Add-On does not include the full Google Play client.
    161 However, it does provide: </p>
    162 
    163 <ul>
    164 <li>An Google Play background service that implements the
    165 <code>ILicensingService</code> remote interface, so that your application can
    166 send license checks over the network to the licensing server. </li>
    167 <li>A set of underlying account services that let you add an a Google account on
    168 the AVD and sign in using your publisher account or test account credentials.
    169 <p>Signing in using your publisher or test account enables you to debug and test
    170 your application without having publish it. For more information see <a
    171 href="#acct-signin">Signing in to an authorized account</a>, below.</p></li>
    172 </ul>
    173 
    174 <p>Several versions of the Google APIs add-on are available through the SDK Manager, but only
    175 the version for Android 2.2 and higher includes the necessary Google
    176 Play services.</p>
    177 
    178 <p>To set up an emulator for adding licensing to an application, follow
    179 these steps: </p>
    180 
    181 <ol>
    182   <li>Launch the Android SDK Manager (available under the Eclipse <strong>Window</strong>
    183 menu or by executing {@code &lt;sdk>/tools/android sdk}).</li>
    184   <li>Select and download <strong>Google APIs</strong> for the Android version you'd like to target
    185 (must be Android 2.2 or higher).</li>
    186   <li>When the download is complete, open the AVD Manager (available under the Eclipse
    187 <strong>Window</strong>
    188 menu or by executing {@code &lt;sdk>/tools/android avd}).</li>
    189   <li>Click
    190 <strong>New</strong> and set the configuration details for the new AVD. </li>
    191   <li>In the dialog that appears, assign a descriptive name to the AVD and then
    192 use the Target menu to choose the <strong>Google APIs</strong> as
    193 the system image to run on the new AVD. Set the other configuration details as
    194 needed and then click <strong>Create AVD</strong> to finish. The SDK tools
    195 create the new AVD configuration, which then appears in the list of available
    196 Android Virtual Devices.</li>
    197 </ol>
    198 
    199 <p>If you are not familiar with AVDs or how to use them, see <a
    200 href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>.</p>
    201 
    202 <h4 id="project-update">Updating your project configuration</h4>
    203 
    204 <p>After you set up a runtime environment that meets the requirements described
    205 above &mdash; either on an actual device or on an emulator &mdash; make sure to
    206 update your application project or build scripts as needed, so that your compiled
    207 <code>.apk</code> files that use licensing are deployed into that environment.
    208 In particular, if you are developing in Eclipse, make sure that you set up a
    209 Run/Debug Configuration that targets the appropriate device or AVD. </p>
    210 
    211 <p>You do not need to make any changes to your application's
    212 build configuration, provided that the project is already configured to compile
    213 against a standard Android 1.5 (API level 3) or higher library. For example:
    214 
    215 <ul>
    216 <li>If you have an existing application that is compiled against
    217 the Android 1.5 library, you do not need to make any changes to your
    218 build configuration to support licensing. The build target meets the minimum
    219 requirements for licensing, so you would continue building
    220 against the same version of the Android platform.</li>
    221 
    222 <li>Similarly, if you are building against Android 1.5 (API level 3) but
    223 are using an emulator running the Google APIs Add-On API 8 as the application's
    224 runtime environment, there is no need to change your application's build
    225 configuration. </li>
    226 </ul>
    227 
    228 <p>In general, adding licensing to an application should have no impact
    229 whatsoever on the application's build configuration.</p>
    230 
    231 
    232 <h3 id="download-lvl">Downloading the LVL</h3>
    233 
    234 <p>The License Verification Library (LVL) is a collection of helper classes that
    235 greatly simplify the work that you need to do to add licensing to your
    236 application. In all cases, we recommend that you download the LVL and use it as
    237 the basis for the licensing implementation in your application.</p>
    238 
    239 <p>The LVL is available as a downloadable package of the Android SDK. The
    240 package includes: </p>
    241 
    242 <ul>
    243 <li>The LVL sources, stored inside an Android library project. </li>
    244 <li>An example application called "sample" that depends on the LVL library
    245 project. The example illustrates how an application uses the library helper
    246 classes to check and enforce licensing.</li>
    247 </ul>
    248 
    249 <p>To download the LVL package into your development environment, use the
    250 Android SDK Manager. Launch the Android SDK Manager and then
    251 select the <strong>Google Market Licensing</strong> package, as shown in figure 2.
    252 Accept the terms and click <strong>Install Selected</strong> to begin the download. </p>
    253 
    254 <img src="{@docRoot}images/licensing_package.png" alt=""/>
    255 <p class="img-caption"><strong>Figure 2.</strong> The Licensing package contains the LVL and
    256 the LVL sample application.</p>
    257 
    258 <p>When the download is complete, the Android SDK Manager installs both
    259 the LVL library project and the example application into these directories: </p>
    260 
    261 <p style="margin-left:2em"><code>&lt;<em>sdk</em>&gt;/extras/google/market_licensing/library/</code>
    262 &nbsp;&nbsp;(the LVL library project)<br />
    263 <code>&lt;<em>sdk</em>&gt;/extras/google/market_licensing/sample/</code>&nbsp;&nbsp;(the example
    264 application)</p>
    265 
    266 <p>If you aren't familiar with how to download packess into your SDK, see the
    267 <a href="{@docRoot}sdk/exploring.html">Exploring the SDK</a>
    268 document. </p>
    269 
    270 
    271 <h3 id="lvl-setup">Setting Up the Licensing Verification Library</h3>
    272 
    273 <p>After downloading the LVL to your computer, you need to set it up in your
    274 development environment, either as an Android library project or by
    275 copying (or importing) the library sources directly into your existing
    276 application package. In general, using the LVL as a library project is recommended,
    277 since it lets you reuse your licensing code across multiple applications and
    278 maintain it more easily over time. Note that the LVL is not designed to be
    279 compiled separately and added to an application as a static .jar file. </p>
    280 
    281 <h4>Moving the library sources to a new location</h4>
    282 
    283 <p>Because you will be customizing the LVL sources to some extent, you should
    284 make sure to <em>move or copy</em> the library sources (the entire
    285 directory at <code>&lt;<em>sdk</em>&gt;/market_licensing/library/</code>)
    286 to a working directory outside of the SDK. You should then use the relocated
    287 sources as your working set. If you are using a source-code management
    288 system, add and track the sources that are in the working location rather
    289 than those in default location in the SDK. </p>
    290 
    291 <p>Moving the library sources is important because when you later update the
    292 Licensing package, the SDK installs the new files to the same location as
    293 the older files. Moving your working library files to a safe location ensures
    294 that your work won't be inadvertently overwritten should you download a new
    295 version of the LVL.</p>
    296 
    297 <h4>Creating the LVL as a library project</h4>
    298 
    299 <div class="sidebox-wrapper">
    300 <div class="sidebox">
    301 <h2>Working with library projects</h2>
    302 
    303 <p>The LVL is provided as an Android library project, which means that you can
    304 share its code and resources across multiple applications. </p>
    305 
    306 <p style="margin-top:.5em;">If you aren't familiar with library projects or how
    307 to use them, see <a href="{@docRoot}tools/projects/index.html#LibraryProjects">
    308 Managing Projects</a>.
    309 </p>
    310 </div>
    311 </div>
    312 
    313 <p>The recommended way of using the LVL is setting it up as a new Android
    314 <em>library project</em>. A library project is a type of development project
    315 that holds shared Android source code and resources. Other Android application
    316 projects can reference the library project and, at build time, include its
    317 compiled sources in their <code>.apk</code> files. In the context of licensing,
    318 this means that you can do most of your licensing development once, in a library
    319 project, then include the library sources in your various application projects.
    320 In this way, you can easily maintain a uniform implementation of licensing
    321 across all of your projects and maintain it centrally. </p>
    322 
    323 <p>The LVL is provided as a configured library project &mdash; once you have
    324 downloaded it, you can start using it right away. </p>
    325 
    326 <p>If you are working in Eclipse with ADT, you need to add the LVL to your
    327 workspace as a new development project, in the same way as you would a new
    328 application project. </p>
    329 
    330 <ol>
    331 <li>Use the New Project Wizard to create a new
    332 project from existing sources. Select the LVL's <code>library</code> directory
    333 (the directory containing the library's AndroidManifest.xml file) as the project
    334 root.</li>
    335 <li>When you are creating the library project, you can select any application
    336 name, package, and set other fields as needed. </li>
    337 <li>For the library's build target, select Android 1.5 (API level 3) or higher.</li>
    338 </ol>
    339 
    340 <p> When created, the project is
    341 predefined as a library project in its <code>project.properties</code> file, so
    342 no further configuration is needed. </p>
    343 
    344 <p>For more information about how to create an application project or work with
    345 library projects in Eclipse, see <a
    346 href="{@docRoot}tools/projects/projects-eclipse.html">Managing Projects from
    347 Eclipse with ADT</a>.</p>
    348 
    349 
    350 <h4>Copying the LVL sources to your application</h4>
    351 
    352 <p>As an alternative to adding the LVL as a library project, you can copy the
    353 library sources directly into your application. To do so, copy (or import) the
    354 LVL's <code>library/src/com</code> directory into your application's
    355 <code>src/</code> directory.</p>
    356 
    357 <p>If you add the LVL sources directly to your application, you can skip the
    358 next section and start working with the library, as described in <a
    359 href="{@docRoot}google/play/licensing/adding-licensing.html">Adding
    360 Licensing to Your App</a>.</p>
    361 
    362 
    363 <h3 id="add-library">Including the LVL library project sources in your
    364 application</h3>
    365 
    366 <p>If you want to use the LVL sources as a library project, you need to add a
    367 reference to the LVL library project in your application project properties. This tells
    368 build tools to include the LVL library project sources in your application at
    369 compile time. The process for adding a reference to a library project depends
    370 on your development environment, as described below.</p>
    371 
    372 <p> If you are developing in Eclipse with ADT, you should already have added the
    373 library project to your workspace, as described in the previous section. If you
    374 haven't done that already, do it now before continuing. </p>
    375 
    376 <p>Next, open the application's project properties window, as shown below.
    377 Select the "Android" properties group and click <strong>Add</strong>, then
    378 choose the LVL library project (com_android_vending_licensing) and click
    379 <strong>OK</strong>. For more information, see
    380 <a href="{@docRoot}tools/projects/projects-eclipse.html#SettingUpLibraryProject">
    381 Managing Projects from Eclipse with ADT</a></p>.
    382 
    383 
    384 <img src="{@docRoot}images/licensing_add_library.png" alt=""/>
    385 <p class="img-caption"><strong>Figure 3.</strong> If you are
    386 working in Eclipse with ADT, you can add the LVL library project to your
    387 application from the application's project properties.</p>
    388 
    389 
    390 <p>If you are developing using the SDK command-line tools, navigate to the
    391 directory containing your application project and open the
    392 <code>project.properties</code> file. Add a line to the file that specifies the
    393 <code>android.library.reference.&lt;n&gt;</code> key and the path to the
    394 library. For example: </p>
    395 
    396 <pre>android.library.reference.1=path/to/library_project</pre>
    397 
    398 <p>Alternatively, you can use this command to update the project
    399 properties, including the reference to the library project:</p>
    400 
    401 <pre class="no-pretty-print" style="color:black">android update lib-project
    402 --target <em>&lt;target_ID&gt;</em> \
    403 --path <em>path/to/my/app_project</em> \
    404 --library <em>path/to/my/library_project</em>
    405 </pre>
    406 
    407 <p>For more information about working with library projects,
    408 see <a href="{@docRoot}tools/projects/projects-cmdline.html#SettingUpLibraryProject">
    409 Setting up a Library Project</a>.</p>
    410 
    411 
    412 
    413 
    414 
    415 
    416 
    417 
    418 
    419 
    420 
    421 
    422 
    423 
    424 
    425 
    426 
    427 
    428 
    429 
    430 
    431 <h2 id="test-env">Setting Up the Testing Environment</h2>
    432 
    433 <p>The Google Play Developer Console provides configuration tools that let you
    434 and others test licensing on your application before it is published. As you are
    435 implementing licensing, you can make use of the Developer Console tools to test
    436 your application's Policy and handling of different licensing responses and
    437 error conditions.</p>
    438 
    439 <p>The main components of the test environment for licensing include: </p>
    440 
    441 <ul>
    442 <li>A "Test response" configuration in your publisher account that lets you
    443 set the static licensing response returned, when the server processes a
    444 license check for an application uploaded to the publisher account, from a user
    445 signed in to the publisher account or a test account.</li>
    446 <li>An optional set of test accounts that will receive the static test
    447 response when they check the license of an application that you have uploaded
    448 (regardless whether the application is published or not).</li>
    449 <li>A runtime environment for the application that includes the Google Play
    450 application or Google APIs Add-On, on which the user is signed in to the
    451 publisher account or one of the test accounts.</li>
    452 </ul>
    453 
    454 <p>Setting up the test environment properly involves:</p>
    455 
    456 <ol>
    457 <li><a href="#test-response">Setting static test responses</a> that are returned by the licensing server.</li>
    458 <li><a href="#test-acct-setup">Setting up test accounts</a> as needed.</li>
    459 <li><a href="#acct-signin">Signing in</a> properly to an emulator or device, before initiating a license check test.</li>
    460 </ol>
    461 
    462 <p>The sections below provide more information.</p>
    463 
    464 
    465 <h3 id="test-response">Setting test responses for license checks</h3>
    466 
    467 <p>Google Play provides a configuration setting in your publisher account
    468 that lets you override the normal processing of a license check and return a
    469 specified static response code. The setting is for testing only and applies
    470 <em>only</em> to license checks for applications that you have uploaded, made by
    471 any user signed in to an emulator or device using the credentials of the
    472 publisher account or a registered test account. For other users, the server
    473 always processes license checks according to normal rules.  </p>
    474 
    475 <p>To set a test response for your account, sign in to your publisher account
    476 and click "Edit Profile". In the Edit Profile page, locate the Test Response
    477 menu in the Licensing panel, shown below. You can select from the full set of
    478 valid server response codes to control the response or condition you want to
    479 test in your application.</p>
    480 
    481 <p>In general, you should make sure to test your application's licensing
    482 implementation with every response code available in the Test Response menu.
    483 For a description of the codes, see <a
    484 href="{@docRoot}google/play/licensing/licensing-reference.html#server-response-codes">Server
    485 Response Codes</a> in the <a
    486 href="{@docRoot}google/play/licensing/licensing-reference.html">Licensing Reference</a>.</p>
    487 
    488 <div style="width:640px;">
    489 <img src="{@docRoot}images/licensing_test_response.png" class="frame">
    490 <p class="img-caption"><strong>Figure 4.</strong> The License Testing
    491 panel of your Account details page lets you set up test accounts and
    492 manage test responses.</p>
    493 </div>
    494 
    495 <p>Note that the test response that you configure applies account-wide &mdash;
    496 that is, it applies not to a single application, but to <em>all</em>
    497 applications associated with the publisher account. If you are testing multiple
    498 applications at once, changing the test response will affect all of those
    499 applications on their next license check (if the user is signed in to
    500 the emulator or device using the publisher account or a test account).</p>
    501 
    502 <p>Before you can successfully receive a test response for a license check,
    503 you must sign in to the device or emulator on which the application
    504 is installed, and from which it is querying the server. Specifically, you must
    505 sign using either your publisher account or one of the test accounts that you
    506 have set up. For more information about test accounts, see the next section.</p>
    507 
    508 <p>See <a
    509 href="{@docRoot}google/play/licensing/licensing-reference.html#server-response-codes">Server
    510 Response Codes</a> for a list of
    511 test responses available and their meanings. </p>
    512 
    513 
    514 <h3 id="test-acct-setup">Setting up test accounts</h3>
    515 
    516 <p>In some cases, you might want to let multiple teams of developers test
    517 licensing on applications that will ultimately be published through your
    518 publisher account, but without giving them access to your publisher account's
    519 sign-in credentials. To meet that need, the Google Play Developer Console lets
    520 you set up one or more optional <em>test accounts</em> &mdash; accounts that are
    521 authorized to query the licensing server and receive static test responses from
    522 your publisher account.</p>
    523 
    524 <p>Test accounts are standard Google accounts that you register on your
    525 publisher account, such that they will receive the test response for
    526 applications that you have uploaded. Developers can then sign in to their
    527 devices or emulators using the test account credentials and initiate license
    528 checks from installed applications. When the licensing server receives a license
    529 check from a user of a test account, it returns the static test response
    530 configured for the publisher account.  </p>
    531 
    532 <p>Necessarily, there are limitations on the access and permissions given to
    533 users signed in through test accounts, including:</p>
    534 
    535 <ul>
    536 <li>Test account users can query the licensing server only for applications that
    537 are already uploaded to the publisher account. </li>
    538 <li>Test account users do not have permission to upload applications to your
    539 publisher account.</li>
    540 <li>Test account users do not have permission to set the publisher account's
    541 static test response.</li>
    542 </ul>
    543 
    544 <p>The table below summarizes the differences in capabilities, between the
    545 publisher account, a test account, and any other account.</p>
    546 
    547 <p class="table-caption" id="acct-types-table"><strong>Table 1.</strong>
    548 Differences in account types for testing licensing.</p>
    549 
    550 <table>
    551 <tr>
    552 <th>Account Type</th>
    553 <th>Can check license before upload?</th>
    554 <th>Can receive test response?</th>
    555 <th>Can set test response?</th>
    556 </tr>
    557 
    558 <tr>
    559 <td>Publisher account</td>
    560 <td>Yes</td>
    561 <td>Yes</td>
    562 <td>Yes</td>
    563 </tr>
    564 
    565 <tr>
    566 <td>Test account</td>
    567 <td>No</td>
    568 <td>Yes</td>
    569 <td>No</td>
    570 </tr>
    571 
    572 <tr>
    573 <td>Other</td>
    574 <td>No</td>
    575 <td>No</td>
    576 <td>No</td>
    577 </tr>
    578 </table>
    579 
    580 <h4 id="reg-test-acct">Registering test accounts on the publisher account</h4>
    581 
    582 <p>To get started, you need to register each test account in your publisher
    583 account. As shown in Figure 4, you
    584 register test accounts in the Licensing panel of your publisher account's Edit
    585 Profile page. Simply enter the accounts as a comma-delimited list and click
    586 <strong>Save</strong> to save your profile changes.</p>
    587 
    588 <p>You can use any Google account as a test account. If you want to own and
    589 control the test accounts, you can create the accounts yourself and distribute
    590 the credentials to your developers or testers.</p>
    591 
    592 <h4 id="test-app-upload">Handling application upload and distribution for test
    593 account users</h4>
    594 
    595 <p>As mentioned above, users of test accounts can only receive static test
    596 responses for applications that are uploaded to the publisher account. Since
    597 those users do not have permission to upload applications, as the publisher you
    598 will need to work with those users to collect apps for upload and distribute
    599 uploaded apps for testing. You can handle collection and distribution in any way
    600 that is convenient. </p>
    601 
    602 <p>Once an application is uploaded and becomes known to the licensing server,
    603 developers and testers can continue modify the application in their local
    604 development environment, without having to upload new versions. You only need to
    605 upload a new version if the local application increments the
    606 <code>versionCode</code> attribute in the manifest file. </p>
    607 
    608 <h4 id="test-key">Distributing your public key to test account users</h4>
    609 
    610 <p>The licensing server handles static test responses in the normal way,
    611 including signing the license response data, adding extras parameters, and so
    612 on. To support developers who are implementing licensing using test accounts
    613 rather than the publisher account, you will need to distribute
    614 the app's public key for licensing to them. Developers without access to the
    615 Developer Console do not have access to the app's public key, and without
    616 the key they won't be able to verify license responses. </p>
    617 
    618 <p>Note that if you decide to generate a new licensing key pair for the app
    619 for some reason, you need to notify all users of test accounts. For
    620 testers, you can embed the new key in the application package and distribute it
    621 to users. For developers, you will need to distribute the new key to them
    622 directly. </p>
    623 
    624 
    625 <h3 id="acct-signin">Signing in to an authorized account in the runtime
    626 environment</h3>
    627 
    628 <p>The licensing service is designed to determine whether a given user is
    629 licensed to use a given application &mdash; during a license check, the Google
    630 Play application gathers the user ID from the primary account on the system
    631 and sends it to the server, together with the package name of the application
    632 and other information. However, if there is no user information available, the
    633 license check cannot succeed, so the Google Play application terminates the
    634 request and returns an error to the application. </p>
    635 
    636 <p>During testing, to ensure that your application can successfully query the
    637 licensing server, you must make sure that you sign in to an account <em>on the
    638 device or emulator</em> using:</p>
    639 
    640 <ul>
    641 <li>The credentials of a publisher account, or</li>
    642 <li>The credentials of a test account that is registered with a publisher
    643 account</li>
    644 </ul>
    645 
    646 
    647 <div class="sidebox-wrapper">
    648 <div class="sidebox">
    649 <h2>Signing in to a Google account on an emulator</h2>
    650 
    651 <p>If you are testing licensing on an emulator, you need to sign in to a Google
    652 account on the emulator. If you do not see an option to create a new Google
    653 account, the problem might be that your AVD is running a standard Android system
    654 image, rather than the Google APIs Add-On, API 8 (release 2) or higher. </p>
    655 
    656 <p style="margin-top:.5em;">For more information, see <a
    657 href="#runtime-setup">Setting up the runtime environment</a>, above.</p>
    658 
    659 </div>
    660 </div>
    661 
    662 <p>Signing in using a publisher account offers the advantage of letting your
    663 applications receive static test responses even before the applications are
    664 uploaded to the Developer Console.</p>
    665 
    666 <p>If you are part of a larger organization or are working with external groups
    667 on applications that will be published through your site, you will more likely
    668 want to distribute test accounts instead, then use those to sign in during
    669 testing. </p>
    670 
    671 <p>To sign in on a device or emulator, follow the steps below. The preferred
    672 approach is to sign in as the primary account &mdash; however, if there are
    673 other accounts already in use on the device or emulator, you can create an
    674 additional account and sign in to it using the publisher or test account
    675 credentials.  </p>
    676 
    677 <ol>
    678 <li>Open Settings &gt; Accounts &amp; sync</li>
    679 <li>Select <strong>Add Account</strong> and choose to add a Google account.
    680 </li>
    681 <li>Select <strong>Next</strong> and then <strong>Sign in</strong>.</li>
    682 <li>Enter the username and password of either the publisher account or a test
    683 account that is registered in the publisher account.</li>
    684 <li>Select <strong>Sign in</strong>. The system signs you in to the new
    685 account.</li>
    686 </ol>
    687 
    688 <p>Once you are signed in, you can begin testing licensing in your application
    689 (if you have completed the LVL integration steps above). When your application
    690 initiates a license check, it will receive a response containing the static test
    691 response configured on the publisher account. </p>
    692 
    693 <p>Note that, if you are using an emulator, you will need to sign in to the
    694 publisher account or test account each time you wipe data when restarting the
    695 emulator.</p>
    696 
    697 <p>Once you've completed the setup procedures, continue to <a
    698 href="{@docRoot}google/play/licensing/adding-licensing.html">Adding Licensing to Your App</a>.</p>
    699 
    700 
    701 
    702