Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit b9dfb12d authored by Andrew Solovay's avatar Andrew Solovay Committed by Android Git Automerger
Browse files

am 38bb601e: am 305f3e21: am 79d3b623: am b9c5af3a: Merge "docs: Removed...

am 38bb601e: am 305f3e21: am 79d3b623: am b9c5af3a: Merge "docs: Removed reference to draft apps." into klp-docs

* commit '38bb601e':
  docs: Removed reference to draft apps.
parents 4e4160cd 38bb601e
Loading
Loading
Loading
Loading
+9 −1
Original line number Diff line number Diff line
@@ -66,7 +66,8 @@ storing and delivering the digital content that you sell in your applications.</
</p>
</div>

<p>You can create a product list for any published application or any draft application that's been
<p>You can create a product list for any published application, or any
application in the alpha or beta channels, that's been
uploaded and saved to the Developer Console. However, you must have a Google Wallet merchant
account and the application's manifest must include the <code>com.android.vending.BILLING</code>
permission. If an application's manifest does not include this permission, you will be able to edit
@@ -75,6 +76,13 @@ information about this permission, see
<a href="{@docRoot}google/play/billing/billing_integrate.html#billing-permission">Updating Your
Application's Manifest</a>.</p>

<p class="note"><strong>Note:</strong> Previously you could test an app by
uploading an unpublished "draft" version. This functionality is no longer
supported; instead, you must publish it to the alpha or beta distribution
channel. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps
are No Longer Supported</a>.

<p>In addition, an application package can have only one product list. If you create a product
list for an application, and you use the <a
href="{@docRoot}google/play/publishing/multiple-apks.html">multiple APK feature</a> to distribute
+54 −77
Original line number Diff line number Diff line
@@ -8,8 +8,9 @@ parent.link=index.html
  <h2>In this document</h2>
  <ol>
    <li><a href="#testing-purchases">Testing In-app Purchases</a></li>
        <li><a href="#billing-testing-static">Testing with static responses</a></li>
    <li><a href="#billing-testing-static">Testing with Static Responses</a></li>
    <li><a href="#billing-testing-real">Setting Up for Test Purchases</a></li>
    <li><a href="#draft_apps">Draft Apps are No Longer Supported</a></li>
  </ol>
  <h2>See also</h2>
  <ol>
@@ -79,8 +80,7 @@ method).</p>
<p>First, upload and publish in-app products that you want testers to be able to
purchase. You can upload and publish in-app products in the Developer Console. 
Note that you can upload and publish your in-app items before you publish the
APK itself. For example, you can publish your in-app items while your APK is
still a draft. </p>
APK itself.</p>

<p>Next, create license test accounts for authorized users. In the Developer
Console, go to <strong>Settings</strong> &gt; <strong>Account details</strong>,
@@ -149,11 +149,12 @@ license accounts in your alpha and beta distribution groups, those users will
only be able to make test purchases. </p>


<h2 id="billing-testing-static">Testing with static responses</h2>
<h2 id="billing-testing-static">Testing with Static Responses</h2>

<p>We recommend that you first test your In-app Billing implementation using static responses from
Google Play. This enables you to verify that your application is handling the primary Google
Play responses correctly and that your application is able to verify signatures correctly.</p>
Play responses correctly and that your application is able to verify signatures correctly. You can do this
even if the app hasn't been published yet.</p>

<p>To test your implementation with static responses, you make an In-app Billing request using a
special item that has a reserved product ID. Each reserved product ID returns a specific static
@@ -173,6 +174,12 @@ the Developer Console to perform static response tests with the reserved product
install your application on a device, log into the device, and make billing requests using the
reserved product IDs.</p>

<p class="note"><strong>Note:</strong> Previously you could test an app by
uploading an unpublished "draft" version. This functionality is no longer
supported. However, you can test your app with static responses even before you
upload it to the Google Play store. For more information, see <a
href="#draft_apps">Draft Apps are No Longer Supported</a>.

<p>There are four reserved product IDs for testing static In-app Billing responses:</p>

<ul>
@@ -205,67 +212,12 @@ Pricing</a>.</p>
  </li>
</ul>

<p>In some cases, the reserved items may return signed static responses, which lets you test
signature verification in your application. To test signature verification with the special reserved
product IDs, you may need to set up <a
href="{@docRoot}google/play/billing/billing_admin.html#billing-testing-setup">test accounts</a> or
upload your application as a unpublished draft application. Table 1 shows you the conditions under
which static responses are signed.</p>

<p class="table-caption" id="static-responses-table"><strong>Table 1.</strong>
Conditions under which static responses are signed.</p>

<table>
<tr>
<th>Application ever been published?</th>
<th>Draft application uploaded and unpublished?</th>
<th>User who is running the application</th>
<th>Static response signature</th>
</tr>

<tr>
<td>No</td>
<td>No</td>
<td>Any</td>
<td>Unsigned</td>
</tr>

<tr>
<td>No</td>
<td>No</td>
<td>Developer</td>
<td>Signed</td>
</tr>

<tr>
<td>Yes</td>
<td>No</td>
<td>Any</td>
<td>Unsigned</td>
</tr>

<tr>
<td>Yes</td>
<td>No</td>
<td>Developer</td>
<td>Signed</td>
</tr>

<tr>
<td>Yes</td>
<td>No</td>
<td>Test account</td>
<td>Signed</td>
</tr>

<tr>
<td>Yes</td>
<td>Yes</td>
<td>Any</td>
<td>Signed</td>
</tr>

</table>
<p>In some cases, the reserved items may return signed static responses, which
lets you test signature verification in your application. The reserved items
only return signed responses if the user running the application has a <a
href="{@docRoot}distribute/googleplay/start.html">developer</a> or <a
href="{@docRoot}google/play/billing/billing_admin.html#billing-testing-setup">test
account.</a>

<p>To make an In-app Billing request with a reserved product ID, you simply construct a normal
<code>REQUEST_PURCHASE</code> request, but instead of using a real product ID from your
@@ -310,9 +262,11 @@ purchases. Testing real in-app purchases enables you to test the end-to-end In-a
experience, including the actual purchases from Google Play and the actual checkout flow that
users will experience in your application.</p>

<p class="note"><strong>Note</strong>: You do not need to publish your application to do end-to-end
testing. You only need to upload your application as a draft application to perform end-to-end
testing.</p>
<p class="note"><strong>Note:</strong> You can do end-to-end testing of your app
  by publishing it to an <a
  href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">alpha
  distribution channel</a>. This allows you to publish the app to the Google
  Play store, but limit its availability to just the testers you designate. </p>

<p>To test your In-app Billing implementation with actual in-app purchases, you will need to
register at least one test account on the Google Play Developer Console. You cannot use your
@@ -327,14 +281,16 @@ application does not need to be published, but the item does need to be publishe
<p>To test your In-app Billing implementation with actual purchases, follow these steps:</p>

<ol>
  <li><strong>Upload your application as a draft application to the Developer Console.</strong>
    <p>You do not need to publish your application to perform end-to-end testing with real product
    IDs; you only need to upload your application as a draft application. However, you must sign
    your application with your release key before you upload it as a draft application. Also, the
    version number of the uploaded application must match the version number of the application you
    load to your device for testing. To learn how to upload an application to Google Play, see
    <a href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=113469">Uploading
    applications</a>.</p>
  <li><strong>Upload your application to the <a
  href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">alpha
  distribution channel</a> with the Developer Console.</strong>

   <p class="note"><strong>Note:</strong> Previously you could test an app by
    uploading an unpublished "draft" version. This functionality is no longer
    supported; instead, you must publish it to the alpha or beta distribution
    channel. For more information, see <a href="#draft_apps">Draft Apps are No
    Longer Supported</a>.

  </li>
  <li><strong>Add items to the application's product list.</strong>
    <p>Make sure that you publish the items (the application can remain unpublished). See <a
@@ -370,3 +326,24 @@ href="{@docRoot}tools/publishing/app-signing.html">signing</a>, and <a
href="{@docRoot}distribute/tools/launch-checklist.html">publishing on Google Play</a>.
</p>

<h2 id="draft_apps">Draft Apps are No Longer Supported</h2>

<p>Previously, you could publish a "draft" version of your app for testing. This
functionality is no longer supported. Instead, there are two ways you can test
how a pre-release app functions on the Google Play store:</p>

<ul>

  <li>You can publish an app to the <a
  href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">alpha
  or beta distribution channels</a>. This makes the app available on the Google
  Play store, but only to the testers you put on a "whitelist".</li>

  <li>In a few cases, you can test Google Play functionality with an unpublished
  app. For example, you can test an unpublished app's in-app billing support by
  using <a
  href="{@docRoot}google/play/billing/billing_testing.html#billing-testing-static">static
  responses</a>, special reserved product IDs that always return a specific
  result (like "purchased" or "refunded").</li>

</ul>
+15 −4
Original line number Diff line number Diff line
@@ -208,6 +208,14 @@ following:</p>
a draft to the Google Play Developer Console. You also need to create a product list for the in-app
items that are available for purchase in the sample application. The following instructions show you
how to do this.</p>

<p class="caution"><strong>Caution:</strong> Draft applications are no longer
supported. To test an application, publish it in the <a
href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">alpha
or beta channels</a>. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps
are No Longer Supported</a>.</p>

<ol>
  <li><strong>Upload the release version of the sample application to Google Play.</strong>
    <p>Do not publish the sample application; leave it as an unpublished draft application. The
@@ -928,8 +936,10 @@ public class BillingReceiver extends BroadcastReceiver {
  // Intent actions that we receive in the BillingReceiver from Google Play.
  // These are defined by Google Play and cannot be changed.
  // The sample application defines these in the Consts.java file.
  public static final String ACTION_NOTIFY = "com.android.vending.billing.IN_APP_NOTIFY";
  public static final String ACTION_RESPONSE_CODE = "com.android.vending.billing.RESPONSE_CODE";
  public static final String ACTION_NOTIFY =
      "com.android.vending.billing.IN_APP_NOTIFY";
  public static final String ACTION_RESPONSE_CODE =
      "com.android.vending.billing.RESPONSE_CODE";
  public static final String ACTION_PURCHASE_STATE_CHANGED =
      "com.android.vending.billing.PURCHASE_STATE_CHANGED";

@@ -962,7 +972,8 @@ public class BillingReceiver extends BroadcastReceiver {
      Log.w(TAG, "unexpected action: " + action);
    }
  }
  // Perform other processing here, such as forwarding intent messages to your local service.
  // Perform other processing here, such as forwarding intent messages
  // to your local service.
}
</pre>

+43 −35
Original line number Diff line number Diff line
@@ -527,17 +527,21 @@ are:</p>
    &lt;!-- Required to download files from Google Play -->
    &lt;uses-permission android:name="android.permission.INTERNET" />

    &lt;!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
    &lt;!-- Required to keep CPU alive while downloading files
        (NOT to keep screen awake) -->
    &lt;uses-permission android:name="android.permission.WAKE_LOCK" />

    &lt;!-- Required to poll the state of the network connection and respond to changes -->
    &lt;uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
    &lt;!-- Required to poll the state of the network connection
        and respond to changes -->
    &lt;uses-permission
        android:name="android.permission.ACCESS_NETWORK_STATE" />

    &lt;!-- Required to check whether Wi-Fi is enabled -->
    &lt;uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>

    &lt;!-- Required to read and write the expansion files on shared storage -->
    &lt;uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    &lt;uses-permission
        android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
    ...
&lt;/manifest>
</pre>
@@ -650,8 +654,8 @@ public class SampleAlarmReceiver extends BroadcastReceiver {
    &#64;Override
    public void onReceive(Context context, Intent intent) {
        try {
            DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent,
                    SampleDownloaderService.class);
            DownloaderClientMarshaller.startDownloadServiceIfRequired(context,
                intent, SampleDownloaderService.class);
        } catch (NameNotFoundException e) {
            e.printStackTrace();
        }
@@ -693,16 +697,19 @@ versionCode)}</li>
    <p>For example, the sample app provided in the Apk Expansion package calls the
following method in the activity's {@link android.app.Activity#onCreate onCreate()} method to check
whether the expansion files already exist on the device:</p>

<pre>
boolean expansionFilesDelivered() {
    for (XAPKFile xf : xAPKS) {
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsBase, xf.mFileVersion);
        String fileName = Helpers.getExpansionAPKFileName(this, xf.mIsBase,
            xf.mFileVersion);
        if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
            return false;
    }
    return true;
}
</pre>

    <p>In this case, each {@code XAPKFile} object holds the version number and file size of a known
expansion file and a boolean as to whether it's the main expansion file. (See the sample
application's {@code SampleDownloaderActivity} class for details.)</p>
@@ -740,6 +747,7 @@ the Downloader Library begins the download and you should update your activity U
display the download progress (see the next step). If the response <em>is</em> {@code
NO_DOWNLOAD_REQUIRED}, then the files are available and your application can start.</p>
    <p>For example:</p>

<pre>
&#64;Override
public void onCreate(Bundle savedInstanceState) {
@@ -754,11 +762,14 @@ public void onCreate(Bundle savedInstanceState) {
                notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);

        // Start the download service (if required)
        int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
        int startResult =
            DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
                        pendingIntent, SampleDownloaderService.class);
        // If download has started, initialize this activity to show download progress
        // If download has started, initialize this activity to show
        // download progress
        if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
            // This is where you do set up to display the download progress (next step)
            // This is where you do set up to display the download
            // progress (next step)
            ...
            return;
        } // If the download wasn't necessary, fall through to start the app
@@ -766,6 +777,7 @@ public void onCreate(Bundle savedInstanceState) {
    startApp(); // Expansion files are available, start the app
}
</pre>

  </li>
  <li>When the {@code startDownloadServiceIfRequired()} method returns anything <em>other
than</em> {@code NO_DOWNLOAD_REQUIRED}, create an instance of {@code IStub} by
@@ -783,9 +795,11 @@ android.app.Activity#onCreate onCreate()} method, after {@code startDownloadServ
starts the download. </p>
    <p>For example, in the previous code sample for {@link android.app.Activity#onCreate
onCreate()}, you can respond to the {@code startDownloadServiceIfRequired()} result like this:</p>

<pre>
        // Start the download service (if required)
        int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
        int startResult =
            DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
                        pendingIntent, SampleDownloaderService.class);
        // If download has started, initialize activity to show progress
        if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
@@ -892,7 +906,8 @@ others. By default, this flag is <em>not</em> enabled, so the user must be on Wi
expansion files. You might want to provide a user preference to enable downloads over
the cellular network. In which case, you can call:
<pre>
mRemoteService.setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
mRemoteService
    .setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
</pre>
</dd>
</dl>
@@ -975,10 +990,12 @@ to both your expansion files:</p>
// The shared path to all app expansion files
private final static String EXP_PATH = "/Android/obb/";

static String[] getAPKExpansionFiles(Context ctx, int mainVersion, int patchVersion) {
static String[] getAPKExpansionFiles(Context ctx, int mainVersion,
      int patchVersion) {
    String packageName = ctx.getPackageName();
    Vector&lt;String> ret = new Vector&lt;String>();
    if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
    if (Environment.getExternalStorageState()
          .equals(Environment.MEDIA_MOUNTED)) {
        // Build the full path to the app's expansion files
        File root = Environment.getExternalStorageDirectory();
        File expPath = new File(root.toString() + EXP_PATH + packageName);
@@ -1102,7 +1119,8 @@ following:</p>

<pre>
// Get a ZipResourceFile representing a merger of both the main and patch files
ZipResourceFile expansionFile = APKExpansionSupport.getAPKExpansionZipFile(appContext,
ZipResourceFile expansionFile =
    APKExpansionSupport.getAPKExpansionZipFile(appContext,
        mainVersion, patchVersion);

// Get an input stream for a known file inside the expansion file ZIPs
@@ -1190,28 +1208,18 @@ android.content.Context#getExternalFilesDir getExternalFilesDir()}.</li>
opens, it's important that you test this process to be sure your application can successfully query
for the URLs, download the files, and save them to the device.</p>

<p>To test your application's implementation of the manual download procedure, you must upload
your application to Google Play as a "draft" to make your expansion files available for
download:</p>

<ol>
  <li>Upload your APK and corresponding expansion files using the Google Play Developer
Console.</li>
  <li>Fill in the necessary application details (title, screenshots, etc.). You can come back and
finalize these details before publishing your application.
  <p>Click the <strong>Save</strong> button. <em>Do not click Publish.</em> This saves
the application as a draft, such that your application is not published for Google Play users,
but the expansion files are available for you to test the download process.</p></li>
  <li>Install the application on your test device using the Eclipse tools or <a
href="{@docRoot}tools/help/adb.html">{@code adb}</a>.</li>
  <li>Launch the app.</li>
</ol>

<p>If everything works as expected, your application should begin downloading the expansion
<p>To test your application's implementation of the manual download procedure,
you can publish it to the alpha or beta channel, so it will only be available to
authorized testers.
If everything works as expected, your application should begin downloading the expansion
files as soon as the main activity starts.</p>



<p class="note"><strong>Note:</strong> Previously you could test an app by
uploading an unpublished "draft" version. This functionality is no longer
supported; instead, you must publish it to the alpha or beta distribution
channel. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps
are No Longer Supported</a>.

<h2 id="Updating">Updating Your Application</h2>

+11 −12
Original line number Diff line number Diff line
@@ -151,7 +151,8 @@ returned by the Google Play server in a license response.</p>
<tr>
<td>{@code LICENSED}</td>
<td>The application is licensed to the user. The user has purchased the
application or the application only exists as a draft.</td>
application, or is authorized to download and install the alpha or beta version
of the application.</td>
<td>Yes</td>
<td><code>VT</code>,&nbsp;<code>GT</code>, <code>GR</code></td>
<td><em>Allow access according to {@code Policy} constraints.</em></td>
@@ -233,16 +234,14 @@ implementation.</p>
href="{@docRoot}google/play/licensing/setting-up.html#test-env">
Setting Up The Testing Environment</a>, the response code can be manually
overridden for the application developer and any registered test users via the
Google Play Developer Console.
<br/><br/>
Additionally, as noted above, applications that are in draft mode (in other
words, applications that have been uploaded but have <em>never</em> been
published) will return {@code LICENSED} for all users, even if not listed as a test
user. Since the application has never been offered for download, it is assumed
that any users running it must have obtained it from an authorized channel for
testing purposes.</p>

Google Play Developer Console.</p>

<p class="note"><strong>Note:</strong> Previously you could test an app by
uploading an unpublished "draft" version. This functionality is no longer
supported; instead, you must publish it to the alpha or beta distribution
channel. For more information, see <a
href="{@docRoot}google/play/billing/billing_testing.html#draft_apps">Draft Apps
are No Longer Supported</a>.


<h2 id="extras">Server Response Extras</h2>
@@ -430,8 +429,8 @@ public boolean allowAccess() {
        }
    } else if (mLastResponse == LicenseResponse.RETRY &amp;&amp;
                ts &lt; mLastResponseTime + MILLIS_PER_MINUTE) {
        // Only allow access if we are within the retry period or we haven't used up our
        // max retries.
        // Only allow access if we are within the retry period
        // or we haven't used up our max retries.
        return (ts &lt;= mRetryUntil || mRetryCount &lt;= mMaxRetries);
    }
    return false;
Loading