summaryrefslogtreecommitdiffstats
path: root/examples/demos/hangman/doc/src/androidclasses.qdoc
blob: 46008dee132d558a0c32bcaa1ebe7a2453f3837b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
// Copyright (C) 2021 The Qt Company Ltd.
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only

/*!
   \page qtpurchasing-androidclasses.html
   \title Demo Android Classes
   \brief Android classes are used in the purchasing demo to enable purchasing in Android.
   \ingroup qtpurchasing-examples

   \section1 Classes
   \table
      \row
         \li \l AndroidInAppProduct
         \li A product registered in the store.
      \row
         \li \l AndroidInAppTransaction
         \li Contains information about a transaction in the external app store.
      \row
         \li \l AndroidInAppPurchaseBackend
         \li Comminucates with external store.
      \row
         \li \c{androidjni.cpp} and \c{InAppPurchase.java}
         \li Communication between Google Play's billing system and C++.
   \endtable

   Check out \l {Base Classes}

   \section1 AndroidInAppProduct

   AndroidInAppProduct adds purchase() for initializing purchasing process.

   \section1 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.

   \section1 AndroidInAppPurchaseBackend

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

   \section2 Initialize

   Shows the products information on the store page.

   \list 1
      \li AndroidInAppPurchaseBackend is called from InAppStore::setupBackend().
      \li At initialization AndroidInAppPurchaseBackend will give \l {https://developer.android.com/reference/android/content/Context} {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.
      \li 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.
      \li When the query is done, productQueryDone() signal is emitted and
         the item's information will be visible on the application's store page.
   \endlist

   \section2 Purchasing

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

   \section1 InAppPurchase.java and androidjni.cpp

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

   \sa {https://developer.android.com/google/play/billing/integrate#java}{Integrate the Google Play Billing Library},
       QJniObject, and QJniEnvironment.
*/