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/start.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 & 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>A 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 Android Studio Tools menu 183 (<strong>Tools > Android > SDK Manager</strong>) or by executing 184 {@code <sdk>/tools/android sdk}.</li> 185 <li>Select and download <strong>Google APIs</strong> for the Android version you'd like to target 186 (must be Android 2.2 or higher).</li> 187 <li>When the download is complete, open the AVD Manager, available under the Android Studio 188 Tools menu (<strong>Tools > Android > AVD Manager</strong>) or by executing 189 {@code <sdk>/tools/android avd}.</li> 190 <li>In the <em>Android Virtual Device Manager</em> window, select 191 <strong>+ Create Virtual Device</strong> to set the configuration details for the new AVD. </li> 192 <li>In the <em>Virtual Device Configuration</em> window, select device hardware, then 193 select <strong>Next</strong>.</li> 194 <li>Select a <strong>Google API</strong> as the system image to run on the new AVD, then 195 select <strong>Next</strong>.</li> 196 <li>Assign a descriptive name to the AVD and then set the other configuration details as 197 needed.</li> 198 <li>Select <strong>Finish</strong> to create the new AVD configuration, which will appear in the 199 list of available Android Virtual Devices.</li> 200 </ol> 201 202 <p>If you are not familiar with AVDs or how to use them, see <a 203 href="{@docRoot}tools/devices/index.html">Managing Virtual Devices</a>.</p> 204 205 <h4 id="project-update">Updating your project configuration</h4> 206 207 <p>After you set up a runtime environment that meets the requirements described 208 above — either on an actual device or on an emulator — make sure to 209 update your application project or build scripts as needed, so that your compiled 210 <code>.apk</code> files that use licensing are deployed into that environment. 211 In particular, if you are developing in Android Studio, make sure that you set up a 212 Run/Debug Configuration that targets the appropriate device or AVD. </p> 213 214 <p>You do not need to make any changes to your application's 215 build configuration, provided that the project is already configured to compile 216 against a standard Android 1.5 (API level 3) or higher library. Adding licensing to an application 217 should have no impact whatsoever on the application's build configuration.</p> 218 219 <h3 id="download-lvl">Downloading the LVL</h3> 220 221 <p>The License Verification Library (LVL) is a collection of helper classes that 222 greatly simplify the work that you need to do to add licensing to your 223 application. In all cases, we recommend that you download the LVL and use it as 224 the basis for the licensing implementation in your application.</p> 225 226 <p>The LVL is available as a downloadable package of the Android SDK. The 227 package includes: </p> 228 229 <ul> 230 <li>The LVL sources, stored inside an Android library project. </li> 231 <li>An example application called "sample" that depends on the LVL library 232 project. The example illustrates how an application uses the library helper 233 classes to check and enforce licensing.</li> 234 </ul> 235 236 <p>To download the LVL package into your development environment, use the 237 Android SDK Manager. Launch the Android SDK Manager and then 238 select the <strong>Google Market Licensing</strong> package, as shown in figure 2. 239 Accept the terms and click <strong>Install Selected</strong> to begin the download. </p> 240 241 <img src="{@docRoot}images/licensing_package.png" alt=""/> 242 <p class="img-caption"><strong>Figure 2.</strong> The Licensing package contains the LVL and 243 the LVL sample application.</p> 244 245 <p>When the download is complete, the Android SDK Manager installs both 246 the LVL library project and the example application into these directories: </p> 247 248 <p style="margin-left:2em"><code><<em>sdk</em>>/extras/google/market_licensing/library/</code> 249 (the LVL library project)<br /> 250 <code><<em>sdk</em>>/extras/google/market_licensing/sample/</code> (the example 251 application)</p> 252 253 <p>If you aren't familiar with how to download packages into your SDK, learn how to 254 <a href="{@docRoot}studio/intro/update.html">update the SDK tools</a>. </p> 255 256 257 <h3 id="lvl-setup">Setting Up the Licensing Verification Library</h3> 258 259 <p>After downloading the LVL to your computer, you need to set it up in your 260 development environment, either as an Android library project or by 261 copying (or importing) the library sources directly into your existing 262 application package. In general, using the LVL as a library project is recommended, 263 since it lets you reuse your licensing code across multiple applications and 264 maintain it more easily over time. Note that the LVL is not designed to be 265 compiled separately and added to an application as a static .jar file. </p> 266 267 <h4>Moving the library sources to a new location</h4> 268 269 <p>Because you will be customizing the LVL sources to some extent, you should 270 make sure to <em>move or copy</em> the library sources (the entire 271 directory at <code><<em>sdk</em>>/market_licensing/library/</code>) 272 to a working directory outside of the SDK. You should then use the relocated 273 sources as your working set. If you are using a source-code management 274 system, add and track the sources that are in the working location rather 275 than those in default location in the SDK. </p> 276 277 <p>Moving the library sources is important because when you later update the 278 Licensing package, the SDK installs the new files to the same location as 279 the older files. Moving your working library files to a safe location ensures 280 that your work won't be inadvertently overwritten should you download a new 281 version of the LVL.</p> 282 283 <h4>Creating the LVL as a library project</h4> 284 285 <div class="sidebox-wrapper"> 286 <div class="sidebox"> 287 <h2>Working with library projects</h2> 288 289 <p>The LVL is provided as an Android library project, which means that you can 290 share its code and resources across multiple applications. </p> 291 292 <p style="margin-top:.5em;">If you aren't familiar with library projects or how 293 to use them, see <a href="{@docRoot}tools/projects/index.html#LibraryProjects"> 294 Managing Projects</a>. 295 </p> 296 </div> 297 </div> 298 299 <p>The recommended way of using the LVL is setting it up as a new Android 300 <em>library project</em>. A library project is a type of development project 301 that holds shared Android source code and resources. Other Android application 302 projects can reference the library project and, at build time, include its 303 compiled sources in their <code>.apk</code> files. In the context of licensing, 304 this means that you can do most of your licensing development once, in a library 305 project, then include the library sources in your various application projects. 306 In this way, you can easily maintain a uniform implementation of licensing 307 across all of your projects and maintain it centrally. </p> 308 309 <p>The LVL is provided as a configured library project — once you have 310 downloaded it, you can start using it right away. </p> 311 312 <p>If you are working in Android Studio, you need to add the LVL to your 313 project as a new module.</p> 314 315 <ol> 316 <li>Use the New Module Wizard to import a library module by selecting 317 <strong>File > New > Import Module</strong>.</li> 318 <li>In the <em>New Module</em> window, in <em>Source directory</em>, enter the LVL's 319 <code>library</code> directory (the directory containing the library's AndroidManifest.xml file) 320 as the project root ({@code <sdk>/extras/google/play_licensing/library/AndroidManifest.xml}), 321 then select <strong>Next</strong>.</li> 322 <li>Select <strong>Finish</strong> to import the library module.</li> 323 </ol> 324 325 <p>For more information about how to work with library modules in Android Studio, see 326 <a href="{@docRoot}studio/projects/android-library.html">Create an Android Library</a>.</p> 327 328 329 <h4>Copying the LVL sources to your application</h4> 330 331 <p>As an alternative to adding the LVL as a library project, you can copy the 332 library sources directly into your application. To do so, copy (or import) the 333 LVL's <code>library/src/com</code> directory into your application's 334 <code>src/</code> directory.</p> 335 336 <p>If you add the LVL sources directly to your application, you can skip the 337 next section and start working with the library, as described in <a 338 href="{@docRoot}google/play/licensing/adding-licensing.html">Adding 339 Licensing to Your App</a>.</p> 340 341 342 <h3 id="add-library">Including the LVL library project sources in your 343 application</h3> 344 345 <p>If you want to use the LVL sources as a library project, you need to add a 346 reference to the LVL library project in your application project properties. This tells 347 build tools to include the LVL library project sources in your application at 348 compile time. The process for adding a reference to a library project depends 349 on your development environment, as described below.</p> 350 351 <p> If you are developing in Android Studio, you should already have added the 352 library module to your project, as described in the previous section. If you 353 haven't done that already, do it now before continuing. </p> 354 355 <p>If you are developing using the SDK command-line tools, navigate to the 356 directory containing your application project and open the 357 <code>project.properties</code> file. Add a line to the file that specifies the 358 <code>android.library.reference.<n></code> key and the path to the 359 library. For example: </p> 360 361 <pre>android.library.reference.1=path/to/library_project</pre> 362 363 <p>Alternatively, you can use this command to update the project 364 properties, including the reference to the library project:</p> 365 366 <pre class="no-pretty-print" style="color:black">android update lib-project 367 --target <em><target_ID></em> \ 368 --path <em>path/to/my/app_project</em> \ 369 --library <em>path/to/my/library_project</em> 370 </pre> 371 372 <p>For more information about working with library projects, 373 see <a href="{@docRoot}tools/projects/projects-cmdline.html#SettingUpLibraryProject"> 374 Setting up a Library Project</a>.</p> 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 <h2 id="test-env">Setting Up the Testing Environment</h2> 397 398 <p>The Google Play Developer Console provides configuration tools that let you 399 and others test licensing on your application before it is published. As you are 400 implementing licensing, you can make use of the Developer Console tools to test 401 your application's Policy and handling of different licensing responses and 402 error conditions.</p> 403 404 <p>The main components of the test environment for licensing include: </p> 405 406 <ul> 407 <li>A "Test response" configuration in your publisher account that lets you 408 set the static licensing response returned, when the server processes a 409 license check for an application uploaded to the publisher account, from a user 410 signed in to the publisher account or a test account.</li> 411 <li>An optional set of test accounts that will receive the static test 412 response when they check the license of an application that you have uploaded 413 (regardless whether the application is published or not).</li> 414 <li>A runtime environment for the application that includes the Google Play 415 application or Google APIs Add-On, on which the user is signed in to the 416 publisher account or one of the test accounts.</li> 417 </ul> 418 419 <p>Setting up the test environment properly involves:</p> 420 421 <ol> 422 <li><a href="#test-response">Setting static test responses</a> that are returned by the licensing server.</li> 423 <li><a href="#test-acct-setup">Setting up test accounts</a> as needed.</li> 424 <li><a href="#acct-signin">Signing in</a> properly to an emulator or device, before initiating a license check test.</li> 425 </ol> 426 427 <p>The sections below provide more information.</p> 428 429 430 <h3 id="test-response">Setting test responses for license checks</h3> 431 432 <p>Google Play provides a configuration setting in your publisher account 433 that lets you override the normal processing of a license check and return a 434 specified static response code. The setting is for testing only and applies 435 <em>only</em> to license checks for applications that you have uploaded, made by 436 any user signed in to an emulator or device using the credentials of the 437 publisher account or a registered test account. For other users, the server 438 always processes license checks according to normal rules. </p> 439 440 <p>To set a test response for your account, sign in to your publisher account 441 and click "Edit Profile". In the Edit Profile page, locate the Test Response 442 menu in the Licensing panel, shown below. You can select from the full set of 443 valid server response codes to control the response or condition you want to 444 test in your application.</p> 445 446 <p>In general, you should make sure to test your application's licensing 447 implementation with every response code available in the Test Response menu. 448 For a description of the codes, see <a 449 href="{@docRoot}google/play/licensing/licensing-reference.html#server-response-codes">Server 450 Response Codes</a> in the <a 451 href="{@docRoot}google/play/licensing/licensing-reference.html">Licensing Reference</a>.</p> 452 453 <div style="width:640px;"> 454 <img src="{@docRoot}images/licensing_test_response.png" class="frame"> 455 <p class="img-caption"><strong>Figure 4.</strong> The License Testing 456 panel of your Account details page lets you set up test accounts and 457 manage test responses.</p> 458 </div> 459 460 <p>Note that the test response that you configure applies account-wide — 461 that is, it applies not to a single application, but to <em>all</em> 462 applications associated with the publisher account. If you are testing multiple 463 applications at once, changing the test response will affect all of those 464 applications on their next license check (if the user is signed in to 465 the emulator or device using the publisher account or a test account).</p> 466 467 <p>Before you can successfully receive a test response for a license check, 468 you must sign in to the device or emulator on which the application 469 is installed, and from which it is querying the server. Specifically, you must 470 sign using either your publisher account or one of the test accounts that you 471 have set up. For more information about test accounts, see the next section.</p> 472 473 <p>See <a 474 href="{@docRoot}google/play/licensing/licensing-reference.html#server-response-codes">Server 475 Response Codes</a> for a list of 476 test responses available and their meanings. </p> 477 478 479 <h3 id="test-acct-setup">Setting up test accounts</h3> 480 481 <p>In some cases, you might want to let multiple teams of developers test 482 licensing on applications that will ultimately be published through your 483 publisher account, but without giving them access to your publisher account's 484 sign-in credentials. To meet that need, the Google Play Developer Console lets 485 you set up one or more optional <em>test accounts</em> — accounts that are 486 authorized to query the licensing server and receive static test responses from 487 your publisher account.</p> 488 489 <p>Test accounts are standard Google accounts that you register on your 490 publisher account, such that they will receive the test response for 491 applications that you have uploaded. Developers can then sign in to their 492 devices or emulators using the test account credentials and initiate license 493 checks from installed applications. When the licensing server receives a license 494 check from a user of a test account, it returns the static test response 495 configured for the publisher account. </p> 496 497 <p>Necessarily, there are limitations on the access and permissions given to 498 users signed in through test accounts, including:</p> 499 500 <ul> 501 <li>Test account users can query the licensing server only for applications that 502 are already uploaded to the publisher account. </li> 503 <li>Test account users do not have permission to upload applications to your 504 publisher account.</li> 505 <li>Test account users do not have permission to set the publisher account's 506 static test response.</li> 507 </ul> 508 509 <p>The table below summarizes the differences in capabilities, between the 510 publisher account, a test account, and any other account.</p> 511 512 <p class="table-caption" id="acct-types-table"><strong>Table 1.</strong> 513 Differences in account types for testing licensing.</p> 514 515 <table> 516 <tr> 517 <th>Account Type</th> 518 <th>Can check license before upload?</th> 519 <th>Can receive test response?</th> 520 <th>Can set test response?</th> 521 </tr> 522 523 <tr> 524 <td>Publisher account</td> 525 <td>Yes</td> 526 <td>Yes</td> 527 <td>Yes</td> 528 </tr> 529 530 <tr> 531 <td>Test account</td> 532 <td>No</td> 533 <td>Yes</td> 534 <td>No</td> 535 </tr> 536 537 <tr> 538 <td>Other</td> 539 <td>No</td> 540 <td>No</td> 541 <td>No</td> 542 </tr> 543 </table> 544 545 <h4 id="reg-test-acct">Registering test accounts on the publisher account</h4> 546 547 <p>To get started, you need to register each test account in your publisher 548 account. As shown in Figure 4, you 549 register test accounts in the Licensing panel of your publisher account's Edit 550 Profile page. Simply enter the accounts as a comma-delimited list and click 551 <strong>Save</strong> to save your profile changes.</p> 552 553 <p>You can use any Google account as a test account. If you want to own and 554 control the test accounts, you can create the accounts yourself and distribute 555 the credentials to your developers or testers.</p> 556 557 <h4 id="test-app-upload">Handling application upload and distribution for test 558 account users</h4> 559 560 <p>As mentioned above, users of test accounts can only receive static test 561 responses for applications that are uploaded to the publisher account. Since 562 those users do not have permission to upload applications, as the publisher you 563 will need to work with those users to collect apps for upload and distribute 564 uploaded apps for testing. You can handle collection and distribution in any way 565 that is convenient. </p> 566 567 <p>Once an application is uploaded and becomes known to the licensing server, 568 developers and testers can continue modify the application in their local 569 development environment, without having to upload new versions. You only need to 570 upload a new version if the local application increments the 571 <code>versionCode</code> attribute in the manifest file. </p> 572 573 <h4 id="test-key">Distributing your public key to test account users</h4> 574 575 <p>The licensing server handles static test responses in the normal way, 576 including signing the license response data, adding extras parameters, and so 577 on. To support developers who are implementing licensing using test accounts 578 rather than the publisher account, you will need to distribute 579 the app's public key for licensing to them. Developers without access to the 580 Developer Console do not have access to the app's public key, and without 581 the key they won't be able to verify license responses. </p> 582 583 <p>Note that if you decide to generate a new licensing key pair for the app 584 for some reason, you need to notify all users of test accounts. For 585 testers, you can embed the new key in the application package and distribute it 586 to users. For developers, you will need to distribute the new key to them 587 directly. </p> 588 589 590 <h3 id="acct-signin">Signing in to an authorized account in the runtime 591 environment</h3> 592 593 <p>The licensing service is designed to determine whether a given user is 594 licensed to use a given application — during a license check, the Google 595 Play application gathers the user ID from the primary account on the system 596 and sends it to the server, together with the package name of the application 597 and other information. However, if there is no user information available, the 598 license check cannot succeed, so the Google Play application terminates the 599 request and returns an error to the application. </p> 600 601 <p>During testing, to ensure that your application can successfully query the 602 licensing server, you must make sure that you sign in to an account <em>on the 603 device or emulator</em> using:</p> 604 605 <ul> 606 <li>The credentials of a publisher account, or</li> 607 <li>The credentials of a test account that is registered with a publisher 608 account</li> 609 </ul> 610 611 612 <div class="sidebox-wrapper"> 613 <div class="sidebox"> 614 <h2>Signing in to a Google account on an emulator</h2> 615 616 <p>If you are testing licensing on an emulator, you need to sign in to a Google 617 account on the emulator. If you do not see an option to create a new Google 618 account, the problem might be that your AVD is running a standard Android system 619 image, rather than the Google APIs Add-On, API 8 (release 2) or higher. </p> 620 621 <p style="margin-top:.5em;">For more information, see <a 622 href="#runtime-setup">Setting up the runtime environment</a>, above.</p> 623 624 </div> 625 </div> 626 627 <p>Signing in using a publisher account offers the advantage of letting your 628 applications receive static test responses even before the applications are 629 uploaded to the Developer Console.</p> 630 631 <p>If you are part of a larger organization or are working with external groups 632 on applications that will be published through your site, you will more likely 633 want to distribute test accounts instead, then use those to sign in during 634 testing. </p> 635 636 <p>To sign in on a device or emulator, follow the steps below. The preferred 637 approach is to sign in as the primary account — however, if there are 638 other accounts already in use on the device or emulator, you can create an 639 additional account and sign in to it using the publisher or test account 640 credentials. </p> 641 642 <ol> 643 <li>Open Settings > Accounts & sync</li> 644 <li>Select <strong>Add Account</strong> and choose to add a Google account. 645 </li> 646 <li>Select <strong>Next</strong> and then <strong>Sign in</strong>.</li> 647 <li>Enter the username and password of either the publisher account or a test 648 account that is registered in the publisher account.</li> 649 <li>Select <strong>Sign in</strong>. The system signs you in to the new 650 account.</li> 651 </ol> 652 653 <p>Once you are signed in, you can begin testing licensing in your application 654 (if you have completed the LVL integration steps above). When your application 655 initiates a license check, it will receive a response containing the static test 656 response configured on the publisher account. </p> 657 658 <p>Note that, if you are using an emulator, you will need to sign in to the 659 publisher account or test account each time you wipe data when restarting the 660 emulator.</p> 661 662 <p>Once you've completed the setup procedures, continue to <a 663 href="{@docRoot}google/play/licensing/adding-licensing.html">Adding Licensing to Your App</a>.</p> 664 665 666 667