Home | History | Annotate | Download | only in publishing
      1 page.title=Publishing on Google Play
      2 @jd:body
      3 
      4 <div id="qv-wrapper">
      5 <div id="qv">
      6 
      7 <h2>Quickview</h2>
      8 
      9 <ul>
     10 <li>Learn how to publish and update apps on Google Play.</li>
     11 <li>Find out how to create links to apps that are published on Google Play.</li>
     12 <li>Learn about Google Play features.</li>
     13 </ul>
     14 
     15 
     16 <h2>In this document</h2>
     17 
     18 <ol>
     19 <li><a href="#overview">About Google Play</a>
     20 <li><A href="#marketpublish">Publishing Apps on Google Play</a></li>
     21 <li><a href="#marketupgrade">Publishing Updates on Google Play</a></li>
     22 <li><a href="#marketLicensing">Using Google Play Licensing Service</a></li>
     23 <li><a href="#marketinappbilling">Using Google Play In-app Billing</a></li>
     24 <li><a href="#marketintent">Linking to Your Apps on Google Play</a>
     25   <ol>
     26     <li><a href="#OpeningDetails">Opening an app's details page</a></li>
     27     <li><a href="#PerformingSearch">Performing a search</a></li>
     28     <li><a href="#BuildaButton">Build a Google Play button</a></li>
     29     <li><a href="#UriSummary">Summary of URI formats</a></li>
     30   </ol>
     31 </li>
     32 </ol>
     33 
     34 <h2>See also</h2>
     35 
     36 <ol>
     37 <li><a href="{@docRoot}tools/publishing/publishing_overview.html">Publishing Overview</a></li>
     38 <li><a href="{@docRoot}tools/publishing/preparing.html">Preparing for Release</a></li>
     39 </ol>
     40 
     41 <div id="qv-extra">
     42   <img id="rule" src="{@docRoot}assets/images/grad-rule-qv.png">
     43   <div id="qv-sub-rule">
     44     <img src="{@docRoot}assets/images/icon_play.png" style="float:left;margin:0;padding:0 5px;">
     45     <h2 style="color:#669999;">Already know about Google Play and want to get started?</h2>
     46     <p>Go to <a href="http://play.google.com/apps/publish">Google Play</a>, create a developer
     47 account, and upload your application. For more information about required assets, listing details,
     48 and publishing options, see <a
     49 href="http://market.android.com/support/bin/answer.py?answer=113469">Upload
     50 Applications</a>.</p>
     51   </div>
     52 </div>
     53 
     54 </div>
     55 </div>
     56 
     57 <p>One of the most effective ways to get your application into users' hands is to
     58 publish it on an application marketplace like Google Play. Publishing on Google Play is a
     59 straightforward process that you can do in just a few simple steps&mdash;register, configure,
     60 upload, and publish. Registration takes only a few minutes and needs to be done only once.
     61 The configuration and publishing steps can all be done through the Google Play Android Developer Console
     62 after you register as a Google Play developer.</p>
     63 
     64 <p>To start publishing on Google Play, first read this topic and then go to the <a
     65 href="https://play.google.com/apps/publish">Google Play Android Developer Console</a> and register as
     66 a Google Play developer.</p>
     67 
     68 
     69 <h2 id="overview">About Google Play</h2>
     70 
     71 <p>Google Play is a robust publishing platform that helps you publicize, sell, and distribute
     72 your Android applications to users around the world. When you release your applications through
     73 Google Play you have access to a suite of developer tools that let you analyze your sales,
     74 identify market trends, and control who your applications are being distributed to. You also have
     75 access to several revenue-enhancing features, such as <a
     76 href="{@docRoot}guide/google/play/billing/index.html">in-app billing</a> and
     77 <a href="{@docRoot}guide/google/play/licensing/index.html">application licensing</a>.</p>
     78 
     79 <p>Before you can publish applications on Google Play, you need to <a
     80 href="http://play.google.com/apps/publish">register</a> as a Google Play developer. During the
     81 registration process you will need to create a developer profile, pay a registration fee, and agree
     82 to the <a href="http://www.android.com/us/developer-distribution-agreement.html">Google Play
     83 Developer Distribution Agreement</a>. After you register you can access the Developer
     84 Console, where you can upload applications, configure publishing options, and monitor publishing
     85 data. If you want to sell your applications or use the in-app billing feature, you will also need
     86 to set up a Google Checkout merchant account. For more information about the registration process,
     87 see <a href="https://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=113468">
     88 Developer Registration</a>.</p>
     89 
     90 <h2 id="marketpublish">Publishing Apps on Google Play</h2>
     91 
     92 <p>Publishing your application on Google Play is a simple process that involves three basic
     93 tasks (see figure 1):</p>
     94 
     95 <ul>
     96   <li>Creating various graphical assets that
     97 accompany your app on Google Play.</li>
     98   <li>Using the Google Play <a
     99 href="http://play.google.com/apps/publish">Developer Console</a> to configure publishing options,
    100 specify listing details, and upload your app and graphical assets to Google Play.</li>
    101   <li>Reviewing your publishing settings and changing the release
    102 status of your app from Unpublished to Published.</li>
    103 </ul>
    104 
    105 <img src="{@docRoot}images/publishing/publishing_android_market.png"
    106      alt="Shows the three steps that are required to publish on Google Play"
    107      height="168"
    108      id="figure1" />
    109 <p class="img-caption">
    110   <strong>Figure 1.</strong> To publish apps on Google Play you must first <a
    111 href="{@docRoot}tools/publishing/preparing.html">prepare your app for release</a> and then perform
    112 three simple tasks.
    113 </p>
    114 
    115 <p class="caution"><strong>Important:</strong> You must <a
    116 href="{@docRoot}tools/publishing/preparing.html">prepare your application for release</a> before you
    117 can publish it on Google Play. When you prepare your application for release you configure it for
    118 release and build it in release mode. Building in release mode signs your application's {@code .apk}
    119 file with your private release key. You cannot publish an application on Google Play unless it is
    120 signed with your own private release key.</p>
    121 
    122 <h3>Preparing promotional materials</h3>
    123 
    124 <p>To fully leverage the marketing and publicity capabilities of Google Play, you need to create
    125 several graphical assets that accompany your app on Google Play, such as screenshots, videos,
    126 promotional graphics, and promotional text. At a minimum you must provide two screenshots of your
    127 application and a high resolution application icon. The screenshots are displayed on the details
    128 page for your application on Google Play, and the high resolution application icon is displayed
    129 in various locations throughout Google Play. The high resolution icon does not replace the
    130 launcher icon for your application, rather, it serves as a supplemental icon and should look
    131 the same as your launcher icon. Promotional video,
    132 graphics, and text are optional, although we strongly recommended that you prepare these for your
    133 app. For more information about the graphic assets that accompany your application, see <a
    134 href="http://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=1078870">Graphic
    135 Assets for your Application</a>.</p>
    136 
    137 <h3>Configuring options and uploading assets</h3>
    138 
    139 <p>Google Play lets you target your application to a worldwide pool of users and devices. To
    140 reach these users you can use the Developer Console to configure various publishing
    141 options and listing details for your app. For example, you can choose the <a
    142 href="http://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=138294&topic=
    143 2365624&ctx=topic">countries</a> you want to reach, the listing languages you want to use, and the
    144 <a
    145 href="http://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=138412&topic=
    146 15867&ctx=topic">price</a> you want to charge in each country. You can also configure listing
    147 details such as the application type, <a
    148 href="https://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=113475&topic=
    149 2365760&ctx=topic">category</a>, and <a
    150 href="http://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=188189&topic=
    151 2364761&ctx=topic">content rating</a>. In addition, if you want to sell items within your app using
    152 the in-app billing feature, you can use the Developer Console to <a
    153 href="http://grendel.sea.corp.google.com:48014/guide/google/play/billing/billing_admin.html#billing-list
    154 - setup">create a product list</a> and control which items are available for purchase in your
    155 app.</p>
    156 
    157 <p>When you are finished setting publishing options and listing details, you can upload your assets
    158 and your application to Google Play. You can also upload your application as a draft
    159 (unpublished) application, which lets you do final testing before you publish it for final
    160 release.</p>
    161 
    162 <p>To learn more about Google Play publishing settings, see the following resources:</p>
    163 
    164 <ul>
    165   <li><a
    166 href="http://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=113469&topic=
    167 236562&ctx=topic">Upload Applications</a>&mdash;provides a summary of the publishing settings
    168 you can configure for an app.</li>
    169   <li><a
    170 href="http://support.google.com/androidmarket/developer/bin/topic.py?hl=en&topic=15867">Selling
    171 Your Apps</a>&mdash;provides guidance about pricing, supported currencies, tax rates, and many
    172 other topics related to selling apps.</li>
    173   <li><a
    174 href="https://support.google.com/androidmarket/developer/bin/answer.py?hl=en&answer=1169947&topic=
    175 15867&ctx=topic">Selling Apps in Multiple Currencies</a>&mdash;provides a description of how
    176 pricing, payouts, and exchange rates work.</li>
    177 </ul>
    178 
    179 <h3>Publishing your application</h3>
    180 
    181 <p>When you are satisfied that your publishing settings are correctly configured and your uploaded
    182 application is ready to be released to the public, you can simply click <strong>Publish</strong> in
    183 the Developer Console to make your app available for download
    184 around the world. Keep in mind, it can take several hours for your app to appear on Google
    185 Play after you click <strong>Publish</strong> in the Developer Console.</p>
    186 
    187 <h3>Controlling Distribution to Devices</h3>
    188 
    189 <p>If your application targets different device configurations, you can control which Android-powered
    190 devices have access to your application on Google Play by
    191 using Google Play filters. Filtering compares device configurations that you declare in your
    192 app's manifest file to the configuration defined by a device. For example, if you declare the camera
    193 filter in your manifest, only those devices that have a camera will see your app on Google
    194 Play. Filters must be configured in your application's manifest file when you are <a
    195 href="{@docRoot}tools/publishing/preparing.html">preparing your app for release</a> (that is, before
    196 you upload your app to Google Play). For more information, see <a
    197 href="{@docRoot}guide/google/play/filters.html">Filters on Google Play</a>.</p>
    198 
    199 <p>You can also use the multiple APK feature to distribute different {@code .apk} files under the same
    200 application listing and the same package name; however, you should use this option only as a last
    201 resort. Android applications usually run on most compatible devices with a single APK, by supplying
    202 alternative resources for different configurations (for example, different layouts for different screen
    203 sizes) and the Android system selects the appropriate resources for the device at runtime. In a
    204 few cases, however, a single APK is unable to support all device configurations, because alternative
    205 resources make the APK file too big (greater than 50MB) or other technical challenges prevent a
    206 single APK from working on all devices. Although we encourage you to develop and publish a single
    207 APK that supports as many device configurations as possible, doing so is sometimes
    208 not possible. To help you publish your application for as many devices as possible, Google Play
    209 allows you to publish multiple APKs under the same application listing. Google Play then supplies
    210 each APK to the appropriate devices based on configuration support you've declared in the manifest
    211 file of each APK. To use this feature, you need to build your separate {@code .apk} files when you are <a
    212 href="{@docRoot}tools/publishing/preparing.html">preparing your app for release</a> (that is, before
    213 you upload your app to Google Play). For more information, see <a
    214 href="{@docRoot}guide/google/play/publishing/multiple-apks.html">Multiple APK Support</a>.</p>
    215 
    216 <h2 id="marketupgrade">Publishing Updates on Google Play</h2>
    217 
    218 <p>At any time after publishing an application on Google Play, you can upload
    219 and publish an update to the same application package. When you publish an
    220 update to an application, users who have already installed the
    221 application may receive a notification that an update is
    222 available for the application. They can then choose to update the application
    223 to the latest version.</p>
    224 
    225 <p>Before uploading the updated application, be sure that you have incremented
    226 the <code>android:versionCode</code> and <code>android:versionName</code>
    227 attributes in the <a
    228 href="{@docRoot}guide/topics/manifest/manifest-element.html"><code>&lt;manifest&gt;</code></a>
    229 element of the manifest file. Also, the package name must be the same as the existing version and
    230 the {@code .apk} file must be signed with the same private key. If the package name and signing
    231 certificate do <em>not</em> match those of the existing version, Google Play will
    232 consider it a new application, publish it as such, and will not offer it to existing users as an
    233 update.</p>
    234 
    235 <p>If you plan to publish your application on Google Play, you must make sure
    236   that it meets the requirements listed below, which are enforced by Google Play
    237   when you upload the application.</p>
    238 
    239 <h2 id="marketLicensing">Using Google Play Licensing Service</h2>
    240 
    241 <p>Google Play offers a licensing service that lets you enforce licensing
    242 policies for paid applications that you publish through Google Play. With
    243 Google Play Licensing, your applications can query Google Play at runtime
    244 to obtain the licensing status for the current user, then allow or disallow
    245 further use of the application as appropriate. Using the service, you can apply a flexible
    246 licensing policy on an application-by-application basis&mdash;each
    247 application can enforce its licensing status in the way most appropriate
    248 for it. </p>
    249 
    250 <p>Any application that you publish through Google Play can use the Google
    251 Play Licensing Service. The service uses no dedicated framework APIs, so you can
    252 add licensing to any application that uses a minimum API Level of 3 or
    253 higher.</p>
    254 
    255 <p>For complete information about Google Play Licensing Service and how to
    256 use it in your application, read <a
    257 href="{@docRoot}guide/google/play/licensing/index.html">Application Licensing</a>.</p>
    258 
    259 <h2 id="marketinappbilling">Using Google Play In-app Billing</h2>
    260 
    261 <p><a href="{@docRoot}guide/google/play/billing/billing_overview.html">Google Play In-app Billing</a>
    262 is a Google Play service that lets you sell digital content in your applications. You can use
    263 the service to sell a wide range of content, including downloadable  content such as media files or
    264 photos, and virtual content such as game levels or potions.</p>
    265 
    266 <p>When you use Google Play's in-app billing service to sell an item, Google Play handles all
    267 billing details so your application never has to directly process any financial transactions.
    268 Google Play uses the same checkout service that is used for application purchases, so your users
    269 experience a consistent and familiar purchase flow (see figure 1). Also, the transaction fee for
    270 in-app purchases is the same as the transaction fee for application purchases (30%).</p>
    271 
    272 <p>Any application that you publish through Google Play can implement in-app billing. No special
    273 account or registration is required other than a Google Play publisher account and a Google
    274 Checkout Merchant account. Also, because the service uses no dedicated framework APIs, you can add
    275 in-app billing to any application that uses a minimum API level of 4 or higher.</p>
    276 
    277 <p>To help you integrate in-app billing into your application, the Android SDK provides a <a
    278 href="{@docRoot}guide/google/play/billing/billing_integrate.html#billing-download">sample application</a>
    279 that demonstrates a simple implementation of in-app billing. The sample application contains
    280 examples of billing-related classes you can use to implement in-app billing in your application. It
    281 also contains examples of the database, user interface, and business logic you might use to
    282 implement in-app billing. For more information about the in-app billing feature, see the
    283 <a href="{@docRoot}guide/google/play/billing/index.html">In-app Billing documentation</a>.</p>
    284 
    285 <h2 id="marketintent">Linking to Your Apps on Google Play</h2>
    286 
    287 <p>To help users discover your published applications, you can use two special Google Play URIs
    288 that direct users to your application's details page or perform a search for all of your published
    289 applications on Google Play. You can use these URIs to create a button in your application or a
    290 link on a web page that:</p>
    291 
    292 <ul>
    293   <li>Opens your application's details page in the Google Play application or web site.</li>
    294   <li>Searches for all your published applications in the Google Play application or web
    295 site.</li>
    296 </ul>
    297 
    298 <p>You can launch the Google Play application or web site in the following ways:</p>
    299 <ul>
    300   <li>Initiate an {@link android.content.Intent} from your application that launches the
    301 Google Play application on the user's device.</li>
    302   <li>Provide a link on a web page that opens the Google Play web site (but will also
    303 open the Google Play application if clicked from a device).</li>
    304 </ul>
    305 
    306 <p>In both cases, whether you want to initiate the action from your application or from a web
    307 page, the URIs are quite similar. The only difference is the URI prefix.</p>
    308 
    309 <p>To open the Google Play application from your application, the prefix for the intent's data
    310 URI is:</p>
    311 
    312 <p style="margin-left:2em"><code>market://</code></p>
    313 
    314 <p>To open Google Play store from your web site, the prefix for the link URI is:</p>
    315 
    316 <p style="margin-left:2em"><code>http://play.google.com/store/</code></p>
    317 
    318 <p>The following sections describe how to create a complete URI for each action.</p>
    319 
    320 <p class="note"><strong>Note:</strong> If you create a link to open Google Play from your web
    321 site and the user selects it from an Android-powered device, the device's Google Play application will
    322 resolve the link so the user can use the Google Play application on the device instead of opening the web
    323 site. As such, you should always use {@code http://play.google.com/store/apps/...} URIs when
    324 creating a link on
    325 a web page. When pointing to your apps from within your Android app, use the
    326 {@code market://} URIs in an intent, so that the Google Play application always opens.</p>
    327 
    328 
    329 <h3 id="OpeningDetails">Opening an app's details page</h3>
    330 
    331 <p>As described above, you can open the details page for a specific application either on the
    332 Google Play application or the Google Play web site. The details page allows the user to see
    333 the application description, screenshots, reviews and more, and choose to install it.</p>
    334 
    335 <p>The format for the URI that opens the details page is:</p>
    336 
    337 <p style="margin-left:2em"><code>&lt;URI_prefix&gt;<b>apps/details?id=</b>&lt;package_name&gt;</code></p>
    338 
    339 <p>The <code>&lt;package_name&gt;</code> is a placeholder for the target application's
    340 fully-qualified package name, as declared in the <a
    341 href="{@docRoot}guide/topics/manifest/manifest-element.html#package">{@code
    342 package}</a> attribute of the <a href="{@docRoot}guide/topics/manifest/manifest-element.html">{@code
    343 &lt;manifest&gt;}</a> element.</p>
    344 
    345 <p>For example: <code>http://play.google.com/store/apps/details?id=com.example.myapp</code></p>
    346 
    347 
    348 <h4>Opening the app details page from your Android app</h4>
    349 
    350 <p>To open the Google Play details page from your application,
    351 create an intent with the {@link android.content.Intent#ACTION_VIEW} action and include a data URI
    352 in this format:</p>
    353 
    354 <p style="margin-left:2em"><code>market://details?id=&lt;package_name&gt;</code></p>
    355 
    356 <p>For example, here's how you can create an intent and open an application's details page in
    357 Google Play:</p>
    358 
    359 <pre>
    360 Intent intent = new Intent(Intent.ACTION_VIEW);
    361 intent.setData(Uri.parse("market://details?id=com.example.android"));
    362 startActivity(intent);
    363 </pre>
    364 
    365 <p>This will open the Google Play application on the device to view the {@code
    366 com.example.android} application.</p>
    367 
    368 
    369 <h4>Opening the app details page from a web site</h4>
    370 
    371 <p>To open the details page from your web site, create a link with a URI in this
    372 format:</p>
    373 
    374 <p style="margin-left:2em">
    375   <code>http://play.google.com/store/apps/details?id=<package_name>;</code>
    376 </p>
    377 
    378 <p>For example, here's a link that opens an application's details page on Google Play:</p>
    379 
    380 <pre>
    381 &lt;a href="http://play.google.com/store/apps/details?id=com.example.android">App Link&lt;/a>
    382 </pre>
    383 
    384 <p>When clicked from a desktop web browser, this opens the Google Play web site to view the
    385 {@code com.example.android} application. When clicked from an Android-powered device, users are
    386 given the option to use either their web browser or the Google Play application to view the
    387 application.</p>
    388 
    389 
    390 
    391 <h3 id="PerformingSearch">Performing a search</h3>
    392 
    393 <p>To initiate a search on Google Play, the format for the URI is:</p>
    394 
    395 <p style="margin-left:2em">
    396   <code>&lt;URI_prefix&gt;<b>search?q=</b>&lt;query&gt;</code>
    397 </p>
    398 
    399 <p>The <code>&lt;query&gt;</code> is a placeholder for the search query to execute in Google
    400 Play. The query can be a raw text string or you can include a parameter that performs a search
    401 based on the publisher name:</p>
    402 
    403 <ul>
    404   <li>To perform a raw text search, append the query string:
    405   <p><code>&lt;URI_prefix&gt;<b>search?q=</b>&lt;search_query&gt;</code></p></li>
    406 
    407   <li>To search based on the publisher name, use the {@code pub:} parameter in the query, followed
    408 by the publisher name:
    409   <p><code>&lt;URI_prefix&gt;<b>search?q=pub:</b>&lt;publisher_name&gt;</code></p>
    410   <p>You can use this type of search to show all of your published applications.</p></li>
    411 </ul>
    412 
    413 
    414 <h4>Searching from your Android app</h4>
    415 
    416 <p>To initiate a search on Google Play from your application, create an intent with the
    417 {@link android.content.Intent#ACTION_VIEW} action and include a data URI in this format:</p>
    418 
    419 <p style="margin-left:2em"><code>market://search?q=&lt;query&gt;</code></p>
    420 
    421 <p>The query may include the {@code pub:} parameter described above.</p>
    422 
    423 <p>For example, here's how you can initiate a search in the Google Play application, based on the
    424 publisher name:</p>
    425 
    426 <pre>
    427 Intent intent = new Intent(Intent.ACTION_VIEW);
    428 intent.setData(Uri.parse("market://search?q=pub:Your Publisher Name"));
    429 startActivity(intent);
    430 </pre>
    431 
    432 <p>This opens the Google Play application to perform the search. The search result shows all
    433 applications published by the publisher that are compatible with the current device.</p>
    434 
    435 
    436 <h4>Searching from a web site</h4>
    437 
    438 <p>To initiate a search on Google Play from your web site, create a link with a URI in this
    439 format:</p>
    440 
    441 <p style="margin-left:2em">
    442   <code>http://play.google.com/store/search?q=<query>;</code>
    443 </p>
    444 
    445 <p>The query may include the {@code pub:} parameter described above.</p>
    446 
    447 <p>For example, here's a link that initiates a search on Google Play, based on the
    448 publisher name:</p>
    449 
    450 <pre>
    451 &lt;a href="http://play.google.com/store/search?q=pub:Your Publisher Name">Search Link&lt;/a>
    452 </pre>
    453 
    454 <p>When clicked from a desktop web browser, this opens the Google Play web site and performs the
    455 search. When clicked from an Android-powered device, users are given the option to use either their
    456 web browser or the Google Play application to perform the search.</p>
    457 
    458 
    459 
    460 <h3 id="BuildaButton">Build a Google Play button</h3>
    461 
    462 <p>Use the following form to create a button for your web site that takes users to your application
    463 on Google Play. Input either your application's package name or your publisher name and the button
    464 will take users to Google Play to either view your application's information or view a list of your
    465 published apps. If users click the button while on an Android-powered device, the Google Play
    466 application will respond to show users your application(s).</p>
    467 
    468 <p>This form offers two styles of the official brand badge each at recommended sizes. You can pick
    469 between either "Get it on Google Play" or "Android app on Google Play." You should not modify the
    470 badge images in any way. For more usage guidelines,
    471 see the <a href="http://www.android.com/branding.html">Android Brand Guidelines</a>.</p>
    472 
    473 <style type="text/css">
    474 
    475 form.button-form {
    476   margin-top:2em;
    477 }
    478 
    479 /* the label and input elements are blocks that float left in order to
    480    keep the left edgets of the input aligned, and IE 6/7 do not fully support "inline-block" */
    481 label.block {
    482   display: block;
    483   float: left;
    484   width: 100px;
    485   padding-right: 10px;
    486 }
    487 
    488 input.text {
    489   display: block;
    490   float: left;
    491   width: 250px;
    492 }
    493 
    494 div.button-row {
    495   white-space:nowrap;
    496   min-height:80px;
    497 }
    498 
    499 div.button-row input {
    500   vertical-align:120%;
    501 }
    502 
    503 #jd-content div.button-row img {
    504   margin: 0;
    505 }
    506 
    507 </style>
    508 
    509 <script type="text/javascript">
    510 
    511 // variables for creating 'try it out' demo button
    512 var imagePath = "http://www.android.com/images/brand/"
    513 var linkStart = "<a href=\"http://play.google.com/store/";
    514 var imageStart = "\">\n"
    515         + "  <img alt=\"";
    516   // leaves opening for the alt text value
    517 var imageSrc = "\"\n       src=\"" + imagePath;
    518   // leaves opening for the image file name
    519 var imageEnd = ".png\" />\n</a>";
    520 
    521 // variables for creating code snippet
    522 var linkStartCode = "&lt;a href=\"http://play.google.com/store/";
    523 var imageStartCode = "\"&gt;\n"
    524         + "  &lt;img alt=\"";
    525   // leaves opening for the alt text value
    526 var imageSrcCode = "\"\n       src=\"" + imagePath;
    527   // leaves opening for the image file name
    528 var imageEndCode = ".png\" />\n&lt;/a>";
    529 
    530 /** Generate the HTML snippet and demo based on form values */
    531 function buildButton(form) {
    532   var selectedValue = $('form input[type=radio]:checked').val();
    533   var altText = selectedValue.indexOf("get_it") != -1 ? "Get it on Google Play" : "Android app on Google Play";
    534 
    535   if (form["package"].value != "com.example.android") {
    536     $("#preview").show();
    537     $("#snippet").show().html(linkStartCode + "apps/details?id=" + form["package"].value
    538             + imageStartCode + altText + imageSrcCode
    539             + selectedValue + imageEndCode);
    540     $("#button-preview").html(linkStart + "apps/details?id=" + form["package"].value
    541             + imageStart + altText + imageSrc
    542             + selectedValue + imageEnd);
    543   } else if (form["publisher"].value != "Example, Inc.") {
    544     $("#preview").show();
    545     $("#snippet").show().html(linkStartCode + "search?q=pub:" + form["publisher"].value
    546             + imageStartCode + altText + imageSrcCode
    547             + selectedValue + imageEndCode);
    548     $("#button-preview").html(linkStart + "search?q=pub:" + form["publisher"].value
    549             + imageStart + altText + imageSrc
    550             + selectedValue + imageEnd);
    551   } else {
    552     alert("Please enter your package name or publisher name");
    553   }
    554   return false;
    555 }
    556 
    557 /** Listen for Enter key */
    558 function onTextEntered(event, form, me) {
    559   // 13 = enter
    560   if (event.keyCode == 13) {
    561     buildButton(form);
    562   }
    563 }
    564 
    565 /** When input is focused, remove example text and disable other input */
    566 function onInputFocus(object, example) {
    567   if (object.value == example) {
    568     $(object).val('').css({'color' : '#000'});
    569   }
    570   $('input[type="text"]:not(input[name='+object.name+'])',
    571           object.parentNode).attr('disabled','true');
    572   $('#'+object.name+'-clear').show();
    573 }
    574 
    575 /** When input is blured, restore example text if appropriate and enable other input */
    576 function onInputBlur(object, example) {
    577   if (object.value.length < 1) {
    578     $(object).attr('value',example).css({'color':'#ccc'});
    579     $('input[type="text"]', object.parentNode).removeAttr('disabled');
    580     $('#'+object.name+'-clear').hide();
    581   }
    582 }
    583 
    584 /** Clear the form to start over */
    585 function clearLabel(id, example) {
    586   $("#preview").hide();
    587   $('#'+id+'').html('').attr('value',example).css({'color':'#ccc'});
    588   $('input[type="text"]', $('#'+id+'').parent()).removeAttr('disabled');
    589   $('#'+id+'-clear').hide();
    590   return false;
    591 }
    592 
    593 /** When the doc is ready, find the inputs and color the input grey if the value is the example
    594     text. This is necessary to handle back-navigation, which can auto-fill the form with previous
    595     values (and text should not be grey) */
    596 $(document).ready(function() {
    597   $(".button-form input.text").each(function(index) {
    598     if ($(this).val() == $(this).attr("default")) {
    599       $(this).css("color","#ccc");
    600     } else {
    601       /* This is necessary to handle back-navigation to the page after form was filled */
    602       $('input[type="text"]:not(input[name='+this.name+'])',
    603               this.parentNode).attr('disabled','true');
    604       $('#'+this.name+'-clear').show();
    605     }
    606   });
    607 });
    608 
    609 </script>
    610 
    611 <form class="button-form">
    612   <label class="block" for="package">Package name:</label>
    613   <input class="text" type="text" id="package" name="package"
    614          value="com.example.android"
    615          default="com.example.android"
    616          onfocus="onInputFocus(this, 'com.example.android')"
    617          onblur="onInputBlur(this, 'com.example.android')"
    618          onkeyup="return onTextEntered(event, this.parentNode, this)"/>&nbsp;
    619          <a id="package-clear" style="display:none" href="#"
    620             onclick="return clearLabel('package','com.example.android');">clear</a>
    621   <p style="clear:both;margin:0">&nbsp;<em>or</em></p>
    622   <label class="block" style="margin-top:5px" for="publisher">Publisher name:</label>
    623   <input class="text" type="text" id="publisher" name="publisher"
    624          value="Example, Inc."
    625          default="Example, Inc."
    626          onfocus="onInputFocus(this, 'Example, Inc.')"
    627          onblur="onInputBlur(this, 'Example, Inc.')"
    628          onkeyup="return onTextEntered(event, this.parentNode, this)"/>&nbsp;
    629          <a id="publisher-clear" style="display:none" href="#"
    630             onclick="return clearLabel('publisher','Example, Inc.');">clear</a>
    631          <br/><br/>
    632 
    633 <div class="button-row">
    634   <input type="radio" name="buttonStyle" value="get_it_on_play_logo_small" id="ns" checked="checked" />
    635     <label for="ns"><img src="http://www.android.com/images/brand/get_it_on_play_logo_small.png"
    636 alt="Get it on Google Play (small)" /></label>
    637     &nbsp;&nbsp;&nbsp;&nbsp;
    638   <input type="radio" name="buttonStyle" value="get_it_on_play_logo_large" id="nm" />
    639     <label for="nm"><img src="http://www.android.com/images/brand/get_it_on_play_logo_large.png"
    640 alt="Get it on Google Play (large)" /></label>
    641 </div>
    642 
    643 <div class="button-row">
    644   <input type="radio" name="buttonStyle" value="android_app_on_play_logo_small" id="ws" />
    645     <label for="ws"><img src="http://www.android.com/images/brand/android_app_on_play_logo_small.png"
    646 alt="Android app on Google Play (small)" /></label>
    647     &nbsp;&nbsp;&nbsp;&nbsp;
    648   <input type="radio" name="buttonStyle" value="android_app_on_play_logo_large" id="wm" />
    649     <label for="wm"><img src="http://www.android.com/images/brand/android_app_on_play_logo_large.png"
    650 alt="Android app on Google Play (large)" /></label>
    651 </div>
    652 
    653   <input type="button" onclick="return buildButton(this.parentNode)" value="Build my button"
    654 style="padding:5px" />
    655   <br/>
    656 </form>
    657 
    658 <div id="preview" style="display:none">
    659   <p>Copy and paste this HTML into your web site:</p>
    660   <textarea id="snippet" cols="100" rows="5" onclick="this.select()"
    661 style="font-family:monospace;background-color:#efefef;padding:5px;display:none;margin-bottom:1em">
    662   </textarea >
    663 
    664 <p>Try it out:</p>
    665 <div id="button-preview" style="margin-top:1em"></div>
    666 </div>
    667 
    668 
    669 
    670 
    671 
    672 
    673 <h3 id="UriSummary">Summary of URI formats</h3>
    674 
    675 <p>The table below provides a summary of the URIs currently supported by the Google Play (both on
    676 the web and in the Android application), as discussed in the previous sections.</p>
    677 
    678 <table>
    679 <tr>
    680 <th>For this result</th>
    681 <th>Use this URI in a web page link</th>
    682 <th>Or this URI in an {@link android.content.Intent#ACTION_VIEW} intent</th>
    683 </tr>
    684 
    685 <tr>
    686 <td>Display the details screen for a specific application</td>
    687 <td><code>http://play.google.com/store/apps/details?id=<package_name>;</code>
    688 <td><code>market://details?id=&lt;package_name&gt;</code></td>
    689 </tr>
    690 
    691 <tr>
    692 <td>Search for applications using a general string query.</td>
    693 <td><code>http://play.google.com/store/search?q=<query>;</code></td>
    694 <td><code>market://search?q=&lt;query&gt;</code></td>
    695 </tr>
    696 
    697 <tr>
    698 <td>Search for applications by publisher name</td>
    699 <td><nobr><code>http://play.google.com/store/search?q=pub:<publisher_name>;</code></nobr></td>
    700 <td><nobr><code>market://search?q=pub:&lt;publisher_name&gt;</code></nobr></td>
    701 </tr>
    702 
    703 </table>
    704