* commit '305f3e216a52af44e1296795803afe4ce17797ca': docs: Removed reference to draft apps.
This commit is contained in:
@@ -66,7 +66,8 @@ storing and delivering the digital content that you sell in your applications.</
|
|||||||
</p>
|
</p>
|
||||||
</div>
|
</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
|
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>
|
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
|
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
|
<a href="{@docRoot}google/play/billing/billing_integrate.html#billing-permission">Updating Your
|
||||||
Application's Manifest</a>.</p>
|
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
|
<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
|
list for an application, and you use the <a
|
||||||
href="{@docRoot}google/play/publishing/multiple-apks.html">multiple APK feature</a> to distribute
|
href="{@docRoot}google/play/publishing/multiple-apks.html">multiple APK feature</a> to distribute
|
||||||
|
|||||||
@@ -8,8 +8,9 @@ parent.link=index.html
|
|||||||
<h2>In this document</h2>
|
<h2>In this document</h2>
|
||||||
<ol>
|
<ol>
|
||||||
<li><a href="#testing-purchases">Testing In-app Purchases</a></li>
|
<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="#billing-testing-real">Setting Up for Test Purchases</a></li>
|
||||||
|
<li><a href="#draft_apps">Draft Apps are No Longer Supported</a></li>
|
||||||
</ol>
|
</ol>
|
||||||
<h2>See also</h2>
|
<h2>See also</h2>
|
||||||
<ol>
|
<ol>
|
||||||
@@ -79,8 +80,7 @@ method).</p>
|
|||||||
<p>First, upload and publish in-app products that you want testers to be able to
|
<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.
|
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
|
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
|
APK itself.</p>
|
||||||
still a draft. </p>
|
|
||||||
|
|
||||||
<p>Next, create license test accounts for authorized users. In the Developer
|
<p>Next, create license test accounts for authorized users. In the Developer
|
||||||
Console, go to <strong>Settings</strong> > <strong>Account details</strong>,
|
Console, go to <strong>Settings</strong> > <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>
|
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
|
<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
|
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
|
<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
|
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
|
install your application on a device, log into the device, and make billing requests using the
|
||||||
reserved product IDs.</p>
|
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>
|
<p>There are four reserved product IDs for testing static In-app Billing responses:</p>
|
||||||
|
|
||||||
<ul>
|
<ul>
|
||||||
@@ -205,67 +212,12 @@ Pricing</a>.</p>
|
|||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
<p>In some cases, the reserved items may return signed static responses, which lets you test
|
<p>In some cases, the reserved items may return signed static responses, which
|
||||||
signature verification in your application. To test signature verification with the special reserved
|
lets you test signature verification in your application. The reserved items
|
||||||
product IDs, you may need to set up <a
|
only return signed responses if the user running the application has a <a
|
||||||
href="{@docRoot}google/play/billing/billing_admin.html#billing-testing-setup">test accounts</a> or
|
href="{@docRoot}distribute/googleplay/start.html">developer</a> or <a
|
||||||
upload your application as a unpublished draft application. Table 1 shows you the conditions under
|
href="{@docRoot}google/play/billing/billing_admin.html#billing-testing-setup">test
|
||||||
which static responses are signed.</p>
|
account.</a>
|
||||||
|
|
||||||
<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>To make an In-app Billing request with a reserved product ID, you simply construct a normal
|
<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
|
<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
|
experience, including the actual purchases from Google Play and the actual checkout flow that
|
||||||
users will experience in your application.</p>
|
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
|
<p class="note"><strong>Note:</strong> You can do end-to-end testing of your app
|
||||||
testing. You only need to upload your application as a draft application to perform end-to-end
|
by publishing it to an <a
|
||||||
testing.</p>
|
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
|
<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
|
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>
|
<p>To test your In-app Billing implementation with actual purchases, follow these steps:</p>
|
||||||
|
|
||||||
<ol>
|
<ol>
|
||||||
<li><strong>Upload your application as a draft application to the Developer Console.</strong>
|
<li><strong>Upload your application to the <a
|
||||||
<p>You do not need to publish your application to perform end-to-end testing with real product
|
href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">alpha
|
||||||
IDs; you only need to upload your application as a draft application. However, you must sign
|
distribution channel</a> with the Developer Console.</strong>
|
||||||
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
|
<p class="note"><strong>Note:</strong> Previously you could test an app by
|
||||||
load to your device for testing. To learn how to upload an application to Google Play, see
|
uploading an unpublished "draft" version. This functionality is no longer
|
||||||
<a href="http://support.google.com/googleplay/android-developer/bin/answer.py?hl=en&answer=113469">Uploading
|
supported; instead, you must publish it to the alpha or beta distribution
|
||||||
applications</a>.</p>
|
channel. For more information, see <a href="#draft_apps">Draft Apps are No
|
||||||
|
Longer Supported</a>.
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li><strong>Add items to the application's product list.</strong>
|
<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
|
<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>.
|
href="{@docRoot}distribute/tools/launch-checklist.html">publishing on Google Play</a>.
|
||||||
</p>
|
</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>
|
||||||
|
|||||||
@@ -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
|
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
|
items that are available for purchase in the sample application. The following instructions show you
|
||||||
how to do this.</p>
|
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>
|
<ol>
|
||||||
<li><strong>Upload the release version of the sample application to Google Play.</strong>
|
<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
|
<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.
|
// Intent actions that we receive in the BillingReceiver from Google Play.
|
||||||
// These are defined by Google Play and cannot be changed.
|
// These are defined by Google Play and cannot be changed.
|
||||||
// The sample application defines these in the Consts.java file.
|
// 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_NOTIFY =
|
||||||
public static final String ACTION_RESPONSE_CODE = "com.android.vending.billing.RESPONSE_CODE";
|
"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 =
|
public static final String ACTION_PURCHASE_STATE_CHANGED =
|
||||||
"com.android.vending.billing.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);
|
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>
|
</pre>
|
||||||
|
|
||||||
|
|||||||
@@ -527,17 +527,21 @@ are:</p>
|
|||||||
<!-- Required to download files from Google Play -->
|
<!-- Required to download files from Google Play -->
|
||||||
<uses-permission android:name="android.permission.INTERNET" />
|
<uses-permission android:name="android.permission.INTERNET" />
|
||||||
|
|
||||||
<!-- Required to keep CPU alive while downloading files (NOT to keep screen awake) -->
|
<!-- Required to keep CPU alive while downloading files
|
||||||
|
(NOT to keep screen awake) -->
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||||
|
|
||||||
<!-- Required to poll the state of the network connection and respond to changes -->
|
<!-- Required to poll the state of the network connection
|
||||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
and respond to changes -->
|
||||||
|
<uses-permission
|
||||||
|
android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||||
|
|
||||||
<!-- Required to check whether Wi-Fi is enabled -->
|
<!-- Required to check whether Wi-Fi is enabled -->
|
||||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE"/>
|
||||||
|
|
||||||
<!-- Required to read and write the expansion files on shared storage -->
|
<!-- Required to read and write the expansion files on shared storage -->
|
||||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
<uses-permission
|
||||||
|
android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||||
...
|
...
|
||||||
</manifest>
|
</manifest>
|
||||||
</pre>
|
</pre>
|
||||||
@@ -650,8 +654,8 @@ public class SampleAlarmReceiver extends BroadcastReceiver {
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
try {
|
try {
|
||||||
DownloaderClientMarshaller.startDownloadServiceIfRequired(context, intent,
|
DownloaderClientMarshaller.startDownloadServiceIfRequired(context,
|
||||||
SampleDownloaderService.class);
|
intent, SampleDownloaderService.class);
|
||||||
} catch (NameNotFoundException e) {
|
} catch (NameNotFoundException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
@@ -693,16 +697,19 @@ versionCode)}</li>
|
|||||||
<p>For example, the sample app provided in the Apk Expansion package calls the
|
<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
|
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>
|
whether the expansion files already exist on the device:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
boolean expansionFilesDelivered() {
|
boolean expansionFilesDelivered() {
|
||||||
for (XAPKFile xf : xAPKS) {
|
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))
|
if (!Helpers.doesFileExist(this, fileName, xf.mFileSize, false))
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
<p>In this case, each {@code XAPKFile} object holds the version number and file size of a known
|
<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
|
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>
|
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
|
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>
|
NO_DOWNLOAD_REQUIRED}, then the files are available and your application can start.</p>
|
||||||
<p>For example:</p>
|
<p>For example:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -754,11 +762,14 @@ public void onCreate(Bundle savedInstanceState) {
|
|||||||
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
notifierIntent, PendingIntent.FLAG_UPDATE_CURRENT);
|
||||||
|
|
||||||
// Start the download service (if required)
|
// Start the download service (if required)
|
||||||
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
|
int startResult =
|
||||||
|
DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
|
||||||
pendingIntent, SampleDownloaderService.class);
|
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) {
|
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;
|
return;
|
||||||
} // If the download wasn't necessary, fall through to start the app
|
} // 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
|
startApp(); // Expansion files are available, start the app
|
||||||
}
|
}
|
||||||
</pre>
|
</pre>
|
||||||
|
|
||||||
</li>
|
</li>
|
||||||
<li>When the {@code startDownloadServiceIfRequired()} method returns anything <em>other
|
<li>When the {@code startDownloadServiceIfRequired()} method returns anything <em>other
|
||||||
than</em> {@code NO_DOWNLOAD_REQUIRED}, create an instance of {@code IStub} by
|
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>
|
starts the download. </p>
|
||||||
<p>For example, in the previous code sample for {@link android.app.Activity#onCreate
|
<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>
|
onCreate()}, you can respond to the {@code startDownloadServiceIfRequired()} result like this:</p>
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
// Start the download service (if required)
|
// Start the download service (if required)
|
||||||
int startResult = DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
|
int startResult =
|
||||||
|
DownloaderClientMarshaller.startDownloadServiceIfRequired(this,
|
||||||
pendingIntent, SampleDownloaderService.class);
|
pendingIntent, SampleDownloaderService.class);
|
||||||
// If download has started, initialize activity to show progress
|
// If download has started, initialize activity to show progress
|
||||||
if (startResult != DownloaderClientMarshaller.NO_DOWNLOAD_REQUIRED) {
|
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
|
expansion files. You might want to provide a user preference to enable downloads over
|
||||||
the cellular network. In which case, you can call:
|
the cellular network. In which case, you can call:
|
||||||
<pre>
|
<pre>
|
||||||
mRemoteService.setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
|
mRemoteService
|
||||||
|
.setDownloadFlags(IDownloaderService.FLAGS_DOWNLOAD_OVER_CELLULAR);
|
||||||
</pre>
|
</pre>
|
||||||
</dd>
|
</dd>
|
||||||
</dl>
|
</dl>
|
||||||
@@ -975,10 +990,12 @@ to both your expansion files:</p>
|
|||||||
// The shared path to all app expansion files
|
// The shared path to all app expansion files
|
||||||
private final static String EXP_PATH = "/Android/obb/";
|
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();
|
String packageName = ctx.getPackageName();
|
||||||
Vector<String> ret = new Vector<String>();
|
Vector<String> ret = new Vector<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
|
// Build the full path to the app's expansion files
|
||||||
File root = Environment.getExternalStorageDirectory();
|
File root = Environment.getExternalStorageDirectory();
|
||||||
File expPath = new File(root.toString() + EXP_PATH + packageName);
|
File expPath = new File(root.toString() + EXP_PATH + packageName);
|
||||||
@@ -1102,7 +1119,8 @@ following:</p>
|
|||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
// Get a ZipResourceFile representing a merger of both the main and patch files
|
// 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);
|
mainVersion, patchVersion);
|
||||||
|
|
||||||
// Get an input stream for a known file inside the expansion file ZIPs
|
// 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
|
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>
|
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
|
<p>To test your application's implementation of the manual download procedure,
|
||||||
your application to Google Play as a "draft" to make your expansion files available for
|
you can publish it to the alpha or beta channel, so it will only be available to
|
||||||
download:</p>
|
authorized testers.
|
||||||
|
If everything works as expected, your application should begin downloading the expansion
|
||||||
<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
|
|
||||||
files as soon as the main activity starts.</p>
|
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>
|
<h2 id="Updating">Updating Your Application</h2>
|
||||||
|
|
||||||
|
|||||||
@@ -151,7 +151,8 @@ returned by the Google Play server in a license response.</p>
|
|||||||
<tr>
|
<tr>
|
||||||
<td>{@code LICENSED}</td>
|
<td>{@code LICENSED}</td>
|
||||||
<td>The application is licensed to the user. The user has purchased the
|
<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>Yes</td>
|
||||||
<td><code>VT</code>, <code>GT</code>, <code>GR</code></td>
|
<td><code>VT</code>, <code>GT</code>, <code>GR</code></td>
|
||||||
<td><em>Allow access according to {@code Policy} constraints.</em></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">
|
href="{@docRoot}google/play/licensing/setting-up.html#test-env">
|
||||||
Setting Up The Testing Environment</a>, the response code can be manually
|
Setting Up The Testing Environment</a>, the response code can be manually
|
||||||
overridden for the application developer and any registered test users via the
|
overridden for the application developer and any registered test users via the
|
||||||
Google Play Developer Console.
|
Google Play Developer Console.</p>
|
||||||
<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>
|
|
||||||
|
|
||||||
|
|
||||||
|
<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>
|
<h2 id="extras">Server Response Extras</h2>
|
||||||
@@ -430,8 +429,8 @@ public boolean allowAccess() {
|
|||||||
}
|
}
|
||||||
} else if (mLastResponse == LicenseResponse.RETRY &&
|
} else if (mLastResponse == LicenseResponse.RETRY &&
|
||||||
ts < mLastResponseTime + MILLIS_PER_MINUTE) {
|
ts < mLastResponseTime + MILLIS_PER_MINUTE) {
|
||||||
// Only allow access if we are within the retry period or we haven't used up our
|
// Only allow access if we are within the retry period
|
||||||
// max retries.
|
// or we haven't used up our max retries.
|
||||||
return (ts <= mRetryUntil || mRetryCount <= mMaxRetries);
|
return (ts <= mRetryUntil || mRetryCount <= mMaxRetries);
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|||||||
@@ -38,12 +38,11 @@ the licensing server and receives the result. The Google Play application sends
|
|||||||
the result to your application, which can allow or disallow further use of the
|
the result to your application, which can allow or disallow further use of the
|
||||||
application as needed.</p>
|
application as needed.</p>
|
||||||
|
|
||||||
<p class="note"><strong>Note:</strong> If a paid application has been uploaded
|
<p class="note"><strong>Note:</strong> If a version of an app is in the alpha or
|
||||||
to Google Play, but saved only as a draft application (the app is
|
beta channel, all users who are authorized to download and install that app are
|
||||||
unpublished), the licensing server considers all users to be licensed users of
|
considered to be licensed users of the app. For more information, see <a
|
||||||
the application (because it's not even possible to purchase the app). This
|
href="{@docRoot}distribute/googleplay/developer-console.html#alpha-beta">Alpha
|
||||||
exception is necessary in order for you to perform testing of your licensing
|
and Beta Testing</a>.</p>
|
||||||
implementation.</p>
|
|
||||||
|
|
||||||
<div class="figure" style="width:469px">
|
<div class="figure" style="width:469px">
|
||||||
<img src="{@docRoot}images/licensing_arch.png" alt=""/>
|
<img src="{@docRoot}images/licensing_arch.png" alt=""/>
|
||||||
@@ -52,6 +51,12 @@ license check through the License Verification Library and the Google Play
|
|||||||
client, which handles communication with the Google Play server.</p>
|
client, which handles communication with the Google Play server.</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<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>To properly identify the user and determine the license status, the licensing server requires
|
<p>To properly identify the user and determine the license status, the licensing server requires
|
||||||
information about the application and user—your application and the Google Play client work
|
information about the application and user—your application and the Google Play client work
|
||||||
|
|||||||
Reference in New Issue
Block a user