Please Upload a Ve Rsion of the default Service (Module) Before Uploading a Version for

Before you lot first adding license verification to your awarding, yous demand to ready your Google Play publishing business relationship, your development environment, and any test accounts required to verify your implementation.

Setting Upward a Publisher Account

If you don't already have a publisher account for Google Play, you need to annals for ane using your Google account and agree to the Google Play terms of service.

For more information, run into Go Started with Publishing.

If you lot already take a publisher account on Google Play, use your Play Panel to prepare upwards licensing.

Using the Google Play Console, you can:

  • Obtain an app-specific public key for licensing
  • Debug and test an awarding's licensing implementation, prior to publishing the application
  • Publish the applications to which yous have added licensing back up

Administrative settings for licensing

Y'all can manage several administrative controls for Google Play licensing in the Play Console. The controls let yous:

  • Ready multiple "examination accounts," identified by email accost. The licensing server allows users signed in to examination accounts on a device or emulator to ship license checks and receive static exam responses. Yous tin fix accounts in the Account Details page of the Play Console.
  • Configure static examination responses that the server sends, when it receives a license check for an application uploaded to the publisher account, from a user signed in to the publisher business relationship or a test account. You can gear up examination responses in the Account Details page of the Play Panel.
  • Obtain the app's public central for licensing. When yous are implementing licensing in an awarding, you must copy the public central string into the awarding. You can obtain the app's public key for licensing in the Services & APIs page (under All Applications).

Effigy 1. An app's license central is available from the Services & APIs folio in the Play Console.

For more information most how to work with examination accounts and static examination responses, run into Setting Up a Testing Environment, below.

Setting Up the Development Environment

Setting up your surroundings for licensing involves these tasks:

  1. Setting upwardly the runtime environs for development
  2. Downloading the LVL into your SDK
  3. Setting up the Licensing Verification Library
  4. Including the LVL library project in your awarding

The sections below describe these tasks. When you are washed with setup, you can brainstorm Adding Licensing to Your App.

To get started, yous need to prepare a proper runtime environs on which y'all can run, debug, and exam your application'due south implementation of license checking and enforcement.

Setting up the runtime environment

As described earlier, applications cheque licensing condition non by contacting the licensing server directly, merely by bounden to a service provided by the Google Play application and initiating a license check request. The Google Play service then handles the direct communication with the licensing server and finally routes the response dorsum to your application. To debug and examination licensing in your application, you need to set up a runtime environment that includes the necessary Google Play service, so that your application is able to send license check requests to the licensing server.

At that place are two types of runtime environment that yous can use:

  • An Android-powered device that includes the Google Play application, or
  • An Android emulator running the Google APIs Improver, API level 8 (release two) or higher

Running on a device

To use an Android-powered device for debugging and testing licensing, the device must:

  • Run a compatible version of Android one.v or later on (API level 3 or higher) platform, and
  • Run a organisation paradigm on which the Google Play client awarding is preinstalled.

If Google Play is not preinstalled in the organisation image, your application won't be able to communicate with the Google Play licensing server.

For general information about how to fix up a device for use in developing Android applications, meet Using Hardware Devices.

Running on an Android emulator

If you lot don't accept a device available, you lot tin can use an Android emulator for debugging and testing licensing.

Because the Android platforms provided in the Android SDK do non include Google Play, you need to download the Google APIs Add-On platform, API level viii (or higher), from the SDK repository. Afterwards downloading the add together-on, you demand to create an AVD configuration that uses that organisation prototype.

The Google APIs Add-On does non include the full Google Play client. Nevertheless, it does provide:

  • A Google Play background service that implements the ILicensingService remote interface, so that your awarding can send license checks over the network to the licensing server.
  • A set of underlying account services that let you add an a Google account on the AVD and sign in using your publisher account or test business relationship credentials.

    Signing in using your publisher or test account enables you to debug and test your application without having publish it. For more than information see Signing in to an authorized account, below.

Several versions of the Google APIs improver are bachelor through the SDK Manager, but just the version for Android ii.two and higher includes the necessary Google Play services.

To set upwards an emulator for calculation licensing to an application, follow these steps:

  1. Launch the Android SDK Manager, bachelor nether the Android Studio Tools card (Tools > Android > SDK Manager) or by executing <sdk>/tools/android sdk.
  2. Select and download Google APIs for the Android version you'd like to target (must be Android 2.ii or higher).
  3. When the download is complete, open the AVD Managing director, available nether the Android Studio Tools carte du jour (Tools > Android > AVD Managing director) or by executing <sdk>/tools/android avd.
  4. In the Android Virtual Device Manager window, select + Create Virtual Device to ready the configuration details for the new AVD.
  5. In the Virtual Device Configuration window, select device hardware, then select Side by side.
  6. Select a Google API as the system epitome to run on the new AVD, then select Next.
  7. Assign a descriptive name to the AVD and then gear up the other configuration details as needed.
  8. Select Finish to create the new AVD configuration, which will announced in the list of available Android Virtual Devices.

If you are non familiar with AVDs or how to utilise them, see Managing Virtual Devices.

Updating your project configuration

Later you fix up a runtime surroundings that meets the requirements described above — either on an actual device or on an emulator — make certain to update your application project or build scripts as needed, so that your compiled .apk files that use licensing are deployed into that surroundings. In item, if you are developing in Android Studio, make sure that you set up a Run/Debug Configuration that targets the appropriate device or AVD.

You lot exercise not need to make any changes to your application's build configuration, provided that the projection is already configured to compile confronting a standard Android 1.5 (API level three) or higher library. Adding licensing to an awarding should have no impact any on the application's build configuration.

Downloading the LVL

The License Verification Library (LVL) is a collection of helper classes that greatly simplify the piece of work that you lot need to do to add together licensing to your application. In all cases, we recommend that you download the LVL and utilise information technology as the ground for the licensing implementation in your application.

The License Verification Library (LVL) is developed on GitHub. You can clone the LVL repository and set information technology as a library project. Clone the repository past typing the following at the command line:

git clone https://github.com/google/play-licensing        

The repository includes:

  • The LVL sources, stored inside an Android library projection.
  • An example awarding called "sample" that depends on the LVL library projection. The case illustrates how an application uses the library helper classes to cheque and enforce licensing.

Setting Upward the Licensing Verification Library

After downloading the LVL to your figurer, you need to set it up in your development surroundings, either equally an Android library project or by copying (or importing) the library sources straight into your existing awarding bundle. In general, using the LVL equally a library project is recommended, since it lets you reuse your licensing code across multiple applications and maintain it more easily over time. Note that the LVL is not designed to be compiled separately and added to an awarding every bit a static .jar file.

The recommended fashion of using the LVL is setting it up every bit a new Android library project. A library project is a blazon of evolution project that holds shared Android source lawmaking and resources. Other Android application projects can reference the library projection and, at build time, include its compiled sources in their .apk files. In the context of licensing, this means that you can do most of your licensing development one time, in a library projection, then include the library sources in your various application projects. In this fashion, you can easily maintain a uniform implementation of licensing across all of your projects and maintain information technology centrally. If you aren't familiar with library projects or how to utilize them, run into Managing Projects.

The LVL is provided as a configured library project — in one case you have downloaded it, yous can get-go using information technology correct abroad.

If you are working in Android Studio, you demand to add the LVL to your project as a new module.

  1. Use the "Import Module from Source" window to import a library module past selecting File > New > Import Module.
  2. In the Import Module from Source window, in Source directory, enter the LVL's library directory (the directory containing the library'due south AndroidManifest.xml file) as the projection root (<sdk>/extras/google/play_licensing/library/AndroidManifest.xml), then select Next.
  3. Select Finish to import the library module.

For more information virtually how to piece of work with library modules in Android Studio, see Create an Android Library.

Including the LVL library projection sources in your awarding

If you want to use the LVL sources equally a library projection, you need to add a reference to the LVL library project in your awarding project properties. This tells build tools to include the LVL library project sources in your awarding at compile fourth dimension. The process for adding a reference to a library project depends on your development surroundings, as described below.

If you are developing in Android Studio, you lot should already have added the library module to your project, as described in the previous section. If yous haven't done that already, do it now before continuing.

If y'all are developing using the SDK command-line tools, navigate to the directory containing your application project and open the project.properties file. Add a line to the file that specifies the android.library.reference.<n> key and the path to the library. For case:

android.library.reference.1=path/to/library_project

Alternatively, y'all can use this command to update the project properties, including the reference to the library project:

android update lib-project --target          <target_ID>          \ --path          path/to/my/app_project          \ --library          path/to/my/library_project        

For more information about working with library projects, run across Setting upwards a Library Project.

Setting Up the Testing Surround

The Google Play Console provides configuration tools that permit you and others test licensing on your application earlier information technology is published. As you lot are implementing licensing, yous can brand apply of the Play Console tools to test your application's Policy and handling of dissimilar licensing responses and error weather.

The chief components of the test environment for licensing include:

  • A "Test response" configuration in your publisher account that lets you set the static licensing response returned, when the server processes a license bank check for an awarding uploaded to the publisher account, from a user signed in to the publisher account or a test business relationship.
  • An optional set of test accounts that will receive the static test response when they check the license of an application that you lot have uploaded (regardless whether the application is published or non).
  • A runtime surroundings for the application that includes the Google Play application or Google APIs Addition, on which the user is signed in to the publisher account or 1 of the test accounts.

Setting upwards the test environment properly involves:

  1. Setting static test responses that are returned by the licensing server.
  2. Setting upwards test accounts every bit needed.
  3. Signing in properly to an emulator or device, earlier initiating a license bank check examination.

The sections below provide more than information.

Setting test responses for license checks

Google Play provides a configuration setting in your publisher account that lets you override the normal processing of a license check and render a specified static response code. The setting is for testing just and applies only to license checks for applications that you take uploaded, fabricated by any user signed in to an emulator or device using the credentials of the publisher business relationship or a registered examination account. For other users, the server always processes license checks co-ordinate to normal rules.

To set a test response for your account, sign in to your publisher account and click "Edit Profile". In the Edit Profile page, locate the Examination Response menu in the Licensing panel, shown beneath. You tin can select from the full set of valid server response codes to control the response or condition you want to test in your application.

In full general, you should make sure to examination your application's licensing implementation with every response code bachelor in the Test Response card. For a description of the codes, see Server Response Codes in the Licensing Reference.

Figure 2. The License Testing panel of your Business relationship details folio lets you lot set up test accounts and manage test responses.

Notation that the exam response that you configure applies account-wide — that is, information technology applies not to a unmarried application, just to all applications associated with the publisher account. If yous are testing multiple applications at once, changing the exam response volition affect all of those applications on their side by side license check (if the user is signed in to the emulator or device using the publisher account or a test account).

Earlier yous tin can successfully receive a test response for a license check, y'all must sign in to the device or emulator on which the application is installed, and from which it is querying the server. Specifically, you must sign using either your publisher account or one of the test accounts that yous have set up. For more information virtually exam accounts, see the next department.

Run across Server Response Codes for a list of examination responses available and their meanings.

Setting upward exam accounts

In some cases, y'all might want to let multiple teams of developers test licensing on applications that will ultimately be published through your publisher account, simply without giving them access to your publisher account's sign-in credentials. To meet that need, the Google Play Panel lets you ready i or more than optional exam accounts — accounts that are authorized to query the licensing server and receive static test responses from your publisher account.

Test accounts are standard Google accounts that you lot register on your publisher account, such that they will receive the test response for applications that you have uploaded. Developers tin can then sign in to their devices or emulators using the exam account credentials and initiate license checks from installed applications. When the licensing server receives a license check from a user of a exam account, it returns the static test response configured for the publisher business relationship.

Necessarily, at that place are limitations on the access and permissions given to users signed in through test accounts, including:

  • Test account users can query the licensing server just for applications that are already uploaded to the publisher account.
  • Exam account users do not accept permission to upload applications to your publisher business relationship.
  • Test business relationship users do not have permission to set the publisher business relationship's static test response.

The tabular array beneath summarizes the differences in capabilities, between the publisher account, a examination account, and any other account.

Table 1. Differences in account types for testing licensing.

Account Type Can check license before upload? Can receive exam response? Tin set test response?
Publisher account Yeah Yes Yes
Test account No Yes No
Other No No No

Registering exam accounts on the publisher business relationship

To go started, you need to register each exam account in your publisher account. Every bit shown in Figure 2, you lot register test accounts in the Licensing panel of your publisher account'due south Edit Profile page. Merely enter the accounts as a comma-delimited list and click Salvage to salve your contour changes.

You can use whatsoever Google account equally a exam account. If you desire to ain and control the test accounts, y'all can create the accounts yourself and distribute the credentials to your developers or testers.

Handling application upload and distribution for examination business relationship users

As mentioned above, users of test accounts can only receive static examination responses for applications that are uploaded to the publisher account. Since those users do non take permission to upload applications, as the publisher you lot will need to work with those users to collect apps for upload and distribute uploaded apps for testing. You can handle collection and distribution in any style that is convenient.

Once an application is uploaded and becomes known to the licensing server, developers and testers can continue alter the application in their local development environment, without having to upload new versions. You only need to upload a new version if the local awarding increments the versionCode attribute in the manifest file.

Distributing your public primal to test business relationship users

The licensing server handles static examination responses in the normal way, including signing the license response data, calculation extras parameters, and so on. To support developers who are implementing licensing using exam accounts rather than the publisher account, you volition demand to distribute the app'south public key for licensing to them. Developers without access to the Play Console do not accept access to the app'due south public cardinal, and without the primal they won't be able to verify license responses.

Note that if you decide to generate a new licensing key pair for the app for some reason, you need to notify all users of test accounts. For testers, you can embed the new key in the application package and distribute it to users. For developers, y'all will demand to distribute the new fundamental to them directly.

Signing in to an authorized business relationship in the runtime environs

The licensing service is designed to determine whether a given user is licensed to use a given application — during a license check, the Google Play awarding gathers the user ID from the master business relationship on the system and sends it to the server, together with the parcel name of the awarding and other information. However, if in that location is no user information available, the license check cannot succeed, so the Google Play application terminates the asking and returns an error to the application.

During testing, to ensure that your application tin can successfully query the licensing server, you lot must make sure that yous sign in to an account on the device or emulator using:

  • The credentials of a publisher business relationship, or
  • The credentials of a test account that is registered with a publisher business relationship

Signing in using a publisher account offers the advantage of letting your applications receive static exam responses even before the applications are uploaded to the Play Panel.

If you are role of a larger organization or are working with external groups on applications that will be published through your site, you will more likely desire to distribute examination accounts instead, then use those to sign in during testing.

To sign in on a device or emulator, follow the steps beneath. The preferred arroyo is to sign in equally the primary account — however, if there are other accounts already in use on the device or emulator, you tin can create an additional account and sign in to it using the publisher or test business relationship credentials.

  1. Open Settings > Accounts & sync
  2. Select Add Account and choose to add a Google account.
  3. Select Next and then Sign in.
  4. Enter the username and password of either the publisher account or a test business relationship that is registered in the publisher business relationship.
  5. Select Sign in. The arrangement signs yous in to the new account.

Once you are signed in, y'all tin brainstorm testing licensing in your application (if yous have completed the LVL integration steps above). When your application initiates a license check, it volition receive a response containing the static test response configured on the publisher business relationship.

Note that, if yous are using an emulator, you volition demand to sign in to the publisher account or examination account each fourth dimension you lot wipe data when restarting the emulator.

Once y'all've completed the setup procedures, proceed to Adding Licensing to Your App.

boyleanstor.blogspot.com

Source: https://developer.android.com/google/play/licensing/setting-up

0 Response to "Please Upload a Ve Rsion of the default Service (Module) Before Uploading a Version for"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel