Solved Qt Purchasing supports Subscriptions on Android?
-
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"
-
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.
-
Subscription on Android are not supported. I experimented with it last month.
See qtbug https://bugreports.qt.io/browse/QTBUG-49606It 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) -
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/.
-
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.
-
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.
-
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
-
@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.
-
@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...
-
You need to grab the QtPurchasing module sources to get that file.
-
@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.
-
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).
-
@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.
-
@hjpriester1967 Was it also necessary to create a .jar file at Qt5.9?
-
@SGaist: This sounds good.
- 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 - Then, how create a .jar file?
Thxs...
- How can I completely (incl. the subdir structur) load the QtPurchase modul into Qt Creator?
-
@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.
-
@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
-
No need for a complete Qt build. Just the module you are interested in.
-
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
-
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?