/****************************************************************************
**
** Copyright (C) 2017 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of the documentation of the Qt Toolkit.
**
** $QT_BEGIN_LICENSE:FDL$
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU Free Documentation License Usage
** Alternatively, this file may be used under the terms of the GNU Free
** Documentation License version 1.3 as published by the Free Software
** Foundation and appearing in the file included in the packaging of
** this file. Please review the following information to ensure
** the GNU Free Documentation License version 1.3 requirements
** will be met: https://www.gnu.org/licenses/fdl-1.3.html.
** $QT_END_LICENSE$
**
****************************************************************************/

/*!

  \page qtpurchasing-googleplay.html
  \title Registering Products in Google Play
  \brief A short guide to registering in-app products in Google Play.

  The Google Play market place allows you to register your application, as well
  as the in-app products you want to make available to it, without publishing
  it. The following guide gives a brief introduction on uploading your
  application to Google Play and registering products.

  For more information, refer to the
  \l{http://developer.android.com/google/play/billing/billing_testing.html}{Android documentation}.

  \section1 Preparing Your Application for Submission

  Before you can upload your application to Google Play, you must prepare it
  for submission.

  \section2 Adding a Manifest XML

  The default \c AndroidManifest.xml generated for applications by Qt is
  suitable for development testing, but cannot be used when submitting the
  application to Google Play.

  Create your own manifest by clicking the
  \uicontrol{Create Templates} button in Qt Creator. You can find the
  button under \uicontrol{Projects} > \uicontrol{Build} tab. Expand
  \uicontrol{Build Android APK} to see it.

  Once the manifest is added to your project, you can modify it. The most
  important parts are the application name and the package name. The
  package name must be unique, and it is recommended to follow the
  com.mycompany.myappname naming convention. The "com.mycompany"
  namespace is based on the Internet domain ownership to avoid naming
  collisions with other applications.

  Other important parts of the manifest include the \c versionCode, which must
  be incremented every time you upload a new version of the application. Other
  properties will decide how your application package
  is presented in the store listing, such as the application name and the version
  name.

  Finally, the application needs the billing permission. If you disabled
  \uicontrol{Include default permissions for Qt modules} from  Qt Creator,
  you'll need to add
  \code
    <uses-permission android:name="com.android.vending.BILLING" />
  \endcode
  to your manifest file.


  For more information on the \c AndroidManifest.xml, see
  \l{http://developer.android.com/guide/topics/manifest/manifest-element.html}{Android documentation}.

  \section2 Signing the Application

  Qt uses the default debug key to sign your application to enable running the
  application on a device. Same key cannot be used to sign the Application Package (APK)
  that is meant to be published on Google Play.

  Use a private a key to sign your application to publish it on Google Play.
  To do so, open the \uicontrol{Build Android APK} in Qt Creator and
  add keystore information. When you are done, select \uicontrol{Release} as
  the build configuration and deploy your project.

  This should create an \c APK file in the build directory of your project.

  \note Save the key used to sign the application for future use. You must
  sign the future versions of the application using the same key.

  \section1 Registering Your Application

  Once the application is prepared for publishing, you can create a listing for
  it in Google Play.

  The first step is to get a publisher account, if you do not already have one.
  Go to \l{https://play.google.com/apps/publish/}{the Google Play developer console},
  log in with the Google account of your choice, and follow the steps as
  directed.

  When you have set up your account, click on \uicontrol{Add new application}
  in Google Play's developer console.

  Fill out as much information as you want in the store listing, and also the
  \uicontrol{Pricing and distribution} page.

  \section2 Publishing Your Application

  In order to test in-app purchases in your application, you first have to
  publish it. To limit the users who can access the application before it is
  ready for production, it can be published as either alpha or beta, in the
  respective tabs on the \uicontrol{APK} page of the developer console. In
  order to make an alpha or beta application, fill out all the required
  information about the application, upload the \c APK file under the
  \uicontrol{Beta testing} or \uicontrol{Alpha testing} tab, and mark the
  application as \uicontrol{published}.

  When the selected test users that you have added to your alpha or beta program
  purchase in-app products in your application, they will make actual purchases
  and will be charged for them. For testing purchases, you can register the e-mail
  addresses that should have testing access, under \uicontrol{Settings}
  in the developer console. The users with these e-mail addresses can purchase
  your in-app products without being charged for the purchase, and the
  transaction is canceled automatically at a later stage.

  \section2 Adding In-App Products

  In order to access in-app products from your application, you must register
  them in Google Play. Go to the \uicontrol{In-app products} page and click
  \uicontrol{Add new product}.

  Fill out the following information about your product:
  \list
   \li \uicontrol{Product ID} - an identifier that is used to access the
   product from your code.
   \li \uicontrol{Product Type} - Choose \uicontrol{Managed product} as this is
   the only type supported by the Qt Purchasing API.
   \li Price for the product in all the different geographical areas where it is
   available.
  \endlist

  Once these details are added, \uicontrol{Activate} the product. If you have
  not published the application yet, the product is marked as
  \uicontrol{To be activated}. Otherwise, it is marked as active. The product
  must be activated before it can be queried from the Qt Purchasing API. If
  the application has recently been published, then it may take a few hours
  before the in-app products can be accessed from your application. Look for
  the \uicontrol{Updates pending} label on the top right side of the screen.
  If this is visible, then there are updates pending which are not yet visible
  from the outside.

  \note Only application packages signed with the same key used for the one in
  Google Play can make purchases in the application. If you want to test
  in-app purchases, make sure the application package is signed before you
  deploy and run it. It's also required that the \c versionCode of the the
  application is same as the package in Google Play. Upload a new package
  to Google Play every time the \c versionCode is updated.

*/

