Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Qt Purchasing supports Subscriptions on Android?
Forum Updated to NodeBB v4.3 + New Features

Qt Purchasing supports Subscriptions on Android?

Scheduled Pinned Locked Moved Solved Mobile and Embedded
22 Posts 8 Posters 5.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • V Offline
    V Offline
    Vitaliy
    wrote on last edited by
    #1

    I registered two in-app products on mu Android Application. One Unlockable Managed Product and another Subscription type product. Then following the instruction given in 'Qt Purchasing' documentation I added the required code. However, I can successfully start purchase flow (call purchase() method) on Unlockable Managed Product but when I call purchase() on the Subscription Type product, I get error "Attempted to purchase unregistered product"

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      The module being pretty new, you should try posting this question on the interest mailing list. You'll find there QtPurchasing developers/maintainers. This forum is more user oriented.

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • H Offline
        H Offline
        hjpriester1967
        wrote on last edited by
        #3

        Subscription on Android are not supported. I experimented with it last month.
        See qtbug https://bugreports.qt.io/browse/QTBUG-49606

        It is possible to hack around it but best would it Qt Purchase add the Subscription support of all mobile platforms .
        (file: qt-purchase-hack.tar contains my changes)

        1 Reply Last reply
        0
        • V Offline
          V Offline
          Vitaliy
          wrote on last edited by Vitaliy
          #4

          Thanks. The best example I see is using java inserts, for example https://github.com/eskilblomfeldt/qthangman and http://blog.qt.io/blog/2013/12/12/implementing-in-app-purchase-on-android/.

          1 Reply Last reply
          0
          • H Offline
            H Offline
            hjpriester1967
            wrote on last edited by
            #5

            I believe the blog describes the source as it was in 2013. It it slightly changed now in Qt 5.9.7. (that was the version I was looking at).

            The problem is in the Qt Java code there is a call: getSkuDetails where there the 3th parameter is always 'inapp'. this parameter needs to be 'subs' for subscription.
            So if you have need to support for subscription ONLY is it easy to hack....if you need to support both you need to do much more. At API level you have to pass the type and modify c++ and java code.

            In my hack: If a product does not exist as an normal 'inapp' type I check if it exist as a 'subs' type and the this type is stored (internally). when doing a purchase I pass the type.

            PowerNowP 1 Reply Last reply
            0
            • V Offline
              V Offline
              Vitaliy
              wrote on last edited by Vitaliy
              #6

              I use https://github.com/eskilblomfeldt/qthangman for example java and Qt C++ interaction. For purchases using this library https://github.com/anjlab/android-inapp-billing-v3. Works great.

              1 Reply Last reply
              2
              • M Offline
                M Offline
                morte
                wrote on last edited by
                #7

                Suggestion about Subscriptions https://bugreports.qt.io/browse/QTBUG-49606 opened 3 years ago and still not implemented, im wondering why this important thing which looks like don't need much effort to implement still not fixed

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #8

                  @morte Because there are so many people working on Qt and tasks have to be prioritise. All the things that "looks like not much effort" still needs proper implementation, tests, etc. So it's rarely that "not much effort" regarding such a feature. However, contributions are always welcome and help get features faster in.

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  2
                  • H hjpriester1967

                    I believe the blog describes the source as it was in 2013. It it slightly changed now in Qt 5.9.7. (that was the version I was looking at).

                    The problem is in the Qt Java code there is a call: getSkuDetails where there the 3th parameter is always 'inapp'. this parameter needs to be 'subs' for subscription.
                    So if you have need to support for subscription ONLY is it easy to hack....if you need to support both you need to do much more. At API level you have to pass the type and modify c++ and java code.

                    In my hack: If a product does not exist as an normal 'inapp' type I check if it exist as a 'subs' type and the this type is stored (internally). when doing a purchase I pass the type.

                    PowerNowP Offline
                    PowerNowP Offline
                    PowerNow
                    wrote on last edited by PowerNow
                    #9

                    @hjpriester1967: I just did the "static test" with the product-id "android.test.purchased" from google billing and it worked fine. Now I tried it with my own product-id from a subscription and I got the message "...unregistered product". So I wanted to modify the QtInAppPurchase.java file and replace "inapp" with "subs" because I only need subscriptions. But this file does not exist in the Qt5.12 folder. I also greped for "getSkuDetails". Now it seems so that this file is archived under the executable root\android_armv7\jar\QtPurchasing.jar. Is there a way to change such files or an other easier way? Thxs...

                    H 1 Reply Last reply
                    0
                    • SGaistS Offline
                      SGaistS Offline
                      SGaist
                      Lifetime Qt Champion
                      wrote on last edited by
                      #10

                      You need to grab the QtPurchasing module sources to get that file.

                      Interested in AI ? www.idiap.ch
                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                      PowerNowP 1 Reply Last reply
                      0
                      • SGaistS SGaist

                        You need to grab the QtPurchasing module sources to get that file.

                        PowerNowP Offline
                        PowerNowP Offline
                        PowerNow
                        wrote on last edited by PowerNow
                        #11

                        @SGaist: Thxs, but what do you exactly mean with grab? As I know now .jar can't be changed. So the "easiest" way would be to modify QTInAppPurchasing.java from the original modul

                        http://code.qt.io/cgit/qt/qtpurchasing.git/tree/src/android/src

                        and create a new .jar file. But I have no experience creating executable .jar files.

                        1 Reply Last reply
                        0
                        • SGaistS Offline
                          SGaistS Offline
                          SGaist
                          Lifetime Qt Champion
                          wrote on last edited by
                          #12

                          Looks like you would have to build the module.

                          You can open it in Qt Creator and build it from there. Then copy the resulting .jar file in your official Qt installation (don't forget to make a backup of the original file just in case).

                          Interested in AI ? www.idiap.ch
                          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                          PowerNowP 1 Reply Last reply
                          0
                          • PowerNowP PowerNow

                            @hjpriester1967: I just did the "static test" with the product-id "android.test.purchased" from google billing and it worked fine. Now I tried it with my own product-id from a subscription and I got the message "...unregistered product". So I wanted to modify the QtInAppPurchase.java file and replace "inapp" with "subs" because I only need subscriptions. But this file does not exist in the Qt5.12 folder. I also greped for "getSkuDetails". Now it seems so that this file is archived under the executable root\android_armv7\jar\QtPurchasing.jar. Is there a way to change such files or an other easier way? Thxs...

                            H Offline
                            H Offline
                            hjpriester1967
                            wrote on last edited by
                            #13

                            @PowerNow I have only looked at Qt 5.9 for the subscription and not at Qt 5.12. My boss decided to put using subscription on Android on hold in the apps for now so I am not using it anymore at the moment.

                            PowerNowP 1 Reply Last reply
                            0
                            • H hjpriester1967

                              @PowerNow I have only looked at Qt 5.9 for the subscription and not at Qt 5.12. My boss decided to put using subscription on Android on hold in the apps for now so I am not using it anymore at the moment.

                              PowerNowP Offline
                              PowerNowP Offline
                              PowerNow
                              wrote on last edited by
                              #14

                              @hjpriester1967 Was it also necessary to create a .jar file at Qt5.9?

                              1 Reply Last reply
                              0
                              • SGaistS SGaist

                                Looks like you would have to build the module.

                                You can open it in Qt Creator and build it from there. Then copy the resulting .jar file in your official Qt installation (don't forget to make a backup of the original file just in case).

                                PowerNowP Offline
                                PowerNowP Offline
                                PowerNow
                                wrote on last edited by
                                #15

                                @SGaist: This sounds good.

                                1. How can I completely (incl. the subdir structur) load the QtPurchase modul into Qt Creator?
                                  http://code.qt.io/cgit/qt/qtpurchasing.git/tree/src/android/src?h=5.9
                                2. Then, how create a .jar file?
                                  Thxs...
                                1 Reply Last reply
                                0
                                • H Offline
                                  H Offline
                                  hjpriester1967
                                  wrote on last edited by
                                  #16

                                  @Powernow: I always use Qt source tar and compile Qt my self. I see you use the precompiled version. The qtpurchasing is subdirectory and the java files are in that tree. The jar files are creating during the make...and after make install these are in the jar subdirectory of the qt installation tree.

                                  PowerNowP 1 Reply Last reply
                                  0
                                  • H hjpriester1967

                                    @Powernow: I always use Qt source tar and compile Qt my self. I see you use the precompiled version. The qtpurchasing is subdirectory and the java files are in that tree. The jar files are creating during the make...and after make install these are in the jar subdirectory of the qt installation tree.

                                    PowerNowP Offline
                                    PowerNowP Offline
                                    PowerNow
                                    wrote on last edited by
                                    #17

                                    @hjpriester1967 So maybe I will also try to compile Qt myself. Thxs...

                                    Another question, as you are using subsriptions.

                                    https://developer.android.com/google/play/billing/api
                                    Because the Google Play client now caches In-app Billing information locally on the device, you can use the In-app Billing API to query for this information more frequently.

                                    If someone unstall/install the app. Do you check e.g. the timestamp from the subscription via the Googles local cashed with getBuyIntent()?

                                    https://forum.qt.io/topic/100193/check-consumable-inapppurchase-on-android-after-app-reinstall

                                    1 Reply Last reply
                                    0
                                    • SGaistS Offline
                                      SGaistS Offline
                                      SGaist
                                      Lifetime Qt Champion
                                      wrote on last edited by
                                      #18

                                      No need for a complete Qt build. Just the module you are interested in.

                                      Interested in AI ? www.idiap.ch
                                      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                      1 Reply Last reply
                                      0
                                      • H Offline
                                        H Offline
                                        h00bs
                                        wrote on last edited by h00bs
                                        #19

                                        There is a Qt plugin for in-app purchase subscriptions on iOS and Android available with Felgo: https://felgo.com/updates/release-3-2-0-qt-5-12-3-subscriptions

                                        Developer at Felgo - https://felgo.com/qt

                                        Develop mobile Apps for iOS & Android with Qt
                                        Develop Games with Qt

                                        Felgo is an official Qt Technology Partner

                                        1 Reply Last reply
                                        0
                                        • G Offline
                                          G Offline
                                          Gourmet
                                          wrote on last edited by Gourmet
                                          #20

                                          up

                                          Any news about this issue? I strongly need in-app subscription for my new Qt5 based Android app. Is there straight and well documented way to implement this?

                                          mrjjM 1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved