Demo Android Classes

Classes

AndroidInAppProductA product registered in the store.
AndroidInAppTransactionContains information about a transaction in the external app store.
AndroidInAppPurchaseBackendComminucates with external store.
androidjni.cpp and InAppPurchase.javaCommunication between Google Play's billing system and C++.

Check out Base Classes

AndroidInAppProduct

AndroidInAppProduct adds purchase() for initializing purchasing process.

AndroidInAppTransaction

AndroidInAppTransaction is created in the AndroidInAppPurchaseBackend using purchaseSucceeded(), purchaseFailed() and checkFinalizationStatus().

AndroidInAppTransaction adds new parameters and return types. Class has finalize() function that separates Consumable and Unlockable products to be either acknowledged or consumed in the InAppPurchase.java.

AndroidInAppPurchaseBackend

AndroidInAppPurchaseBackend makes and receives calls from InAppPurchase.java. This class is one of the back end components in the application.

Initialize

Shows the products information on the store page.

  1. AndroidInAppPurchaseBackend is called from InAppStore::setupBackend().
  2. At initialization AndroidInAppPurchaseBackend will give Context and pointer of its self to the Java in the calls constructor and then initializes the connection to the Google Play store using the initialize() function.
  3. When the connection is successful, androidjni will call registerRedy() which emits the ready() signal to InAppStore and starts queryProducts() function to get the information of the purchasable items.
  4. When the query is done, productQueryDone() signal is emitted and the item's information will be visible on the application's store page.

Purchasing

When pressing one of the products on the applications store page a call is routed through AndroidInAppProduct::purchase() to purchaseProduct() function. This then calls the Java method launchBillingFlow() which opens Goole Plays billing flow to the user.

InAppPurchase.java and androidjni.cpp

AndroidInAppPurchaseBackend makes calls directly to InAppPurchase.java and receives Java calls from androidjni. The demo application communicates with Java function using QJniObject.

See also Integrate the Google Play Billing Library, QJniObject, and QJniEnvironment.

© 2024 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.