John van de Waeter 7 Posted September 29, 2021 (edited) Hi All, I have a nice Android app, developed in D 10.4.2, which includes In-App purchases. It runs on Android 6 and above. 1. The new Delphi 11 says the Android app will run on Android 8 and above. This would be bad news for my cutomers with Android 6 and 7 2. Google says per november 2021 the new app billing service needs to be used. Unless this new app billing service could be used by Delphi 10.4.2, I'm forced to use D11 but that would be bad news for (see above). It would be nice if either - D10.4.2 could handle te new Billing Service, so I could service those oldAndroid clients for say another year or - D11 can be used to create Android apps for Android 6 and 7. I guess there's a little more to it then just changing the minSDKVersion? Any tips? Greatly appreciated! tnx, John Edited September 29, 2021 by John van de Waeter Share this post Link to post
Rollo62 536 Posted September 29, 2021 The marketing of D11 claims that it has the latest billing service, if that is what you need, but I haven't checked if its working. Quote Compile for Android API 30! Android API and Libraries updated - API 30, Google Play V3, Android X. Keep current with the latest requirements for Android as the platform evolves. This includes the latest billing API (required by Google Play Store). Enhanced Delphi and C++ RTL for Android, with support for Android API level 30. Support for the new “AndroidX” libraries. In-app purchase component to help monetize your applications. Android solution Google Play Billing Library Version 4. Enhanced FireMonkey Application Platform for creating native Android ARMv7 applications for Android 11, 10, Pie (9.0), Oreo (8.1) Share this post Link to post
Dave Nottage 557 Posted September 30, 2021 7 hours ago, John van de Waeter said: 1. The new Delphi 11 says the Android app will run on Android 8 and above. This would be bad news for my cutomers with Android 6 and 7 It says the officially supported versions are Android 8 and above. That does not mean apps will not run on lower versions - I have apps built with Delphi 11 running on Android 4.4. Share this post Link to post
John van de Waeter 7 Posted September 30, 2021 Thanks Dave, Apart from some minor changes in my own code it seems to work... Share this post Link to post
Chris Pim 34 Posted October 5, 2021 Hi John The new Android requirements from November also include a requirement to support SDK 30 (as well as the new billing APIs). To avoid having to upgrade to Delphi 11 just as it was launched (generally a little hit-and-miss) I looked into supporting the new requirements for Delphi 10.4 instead. Unfortunately I hit a brick wall with the SDK 30 update. Too many internal components of Delphi 10.4 don't work properly with SDK 30, so it wasn't feasible. The billing API support was fairly straightforward as it could be bolted into 10.4, but without SDK 30 support it wouldn't be allowed onto the Play Store anyway. Best to upgrade to Delphi 11 - it seems pretty solid and a good upgrade so far. 2 Share this post Link to post
John van de Waeter 7 Posted October 6, 2021 Hi Chris, I tried. From a 10.4.2 project, I copied the sources to a new Alexandria directory. - removed all Android and iOS related files - removed the DProj and .dsk files - opened in D11`, reverting all library files to default Compile, install, run, test: NO PROBLEMS Upload to Google: Accepted, but with the same warning about the Billing Services: must use version 3 or higher. Appearantly my app doesn't meet the november 1 requierments... In the Libraries-section of the project I see billing-4.0.0.dex.jar though. Any idea how/where else to check for the correct Billing library? Share this post Link to post
Dave Nottage 557 Posted October 6, 2021 (edited) Oops.. it looks like something may have been missed. Can you add the following to the application node of AndroidManifest.template.xml: <meta-data android:name="com.google.android.play.billingclient.version" android:value="4.0.0" /> ..and try again? If this fixes it, I'll file a report in the Quality Portal, unless you want to 🙂 If it doesn't fix it, you might like to use this tool: https://github.com/skylot/jadx to look inside classes.dex in the project output folder, and make sure com.android.billingclient is in there. Perhaps do this first Edited October 6, 2021 by Dave Nottage Share this post Link to post
Chris Pim 34 Posted October 7, 2021 Hi John, I haven't tried uploading a D11 build to the Play Store yet, but when I do I'll let you know what mine says. Dave's suggestion is a good one and will hopefully solve it, but it's also worth mentioning there's a new item in the Entitlements section of the Project Options you need to tick for billing. What this seems to do is add the entry into the manifest for you (the one Dave mentioned, so you won't need to manually add it) but may do some other things you need. Good luck! Share this post Link to post
Dave Nottage 557 Posted October 7, 2021 1 hour ago, Chris Pim said: What this seems to do is add the entry into the manifest for you (the one Dave mentioned, so you won't need to manually add it) The In App Purchase Service option adds the activity entry for the billing service, not the meta-data tag. Share this post Link to post
Chris Pim 34 Posted October 7, 2021 Ah, thanks Dave - that's really useful to know! Share this post Link to post
Chris Pim 34 Posted October 8, 2021 I’ve just read this, which may be useful for the question: Remove: <uses-permission android:name="com.android.vending.BILLING" />from AndroidManifest.xml in android app folder. Since Nov 1st Google count that as a sign of V2 billing library and does not approve releases. 2 Share this post Link to post
John van de Waeter 7 Posted October 10, 2021 Dave, Chris, I've first checked the Classes.dex with the jadx-tool, and all info I could find was about Billing version 4.0, so this looked okay. The Check in the Entitlements list was already there. Then I tried a new build to upload to the playstore with the meta-data line Dave mentioned included, and Voila, accepted without the warning! 🙂 I think you'd better file it to QC Dave, that will definitely draw more attention... Thanks for the help guys! John Share this post Link to post
Dave Nottage 557 Posted October 10, 2021 (edited) 10 hours ago, John van de Waeter said: meta-data line Dave mentioned included, and Voila, accepted without the warning! Is this your experience, @Chris Pim ? I am yet to submit an app to Play Store that has IAP. 10 hours ago, John van de Waeter said: I think you'd better file it to QC Dave https://quality.embarcadero.com/browse/RSP-35834 Edited October 10, 2021 by Dave Nottage Share this post Link to post
Chris Pim 34 Posted October 11, 2021 22 hours ago, Dave Nottage said: Is this your experience, @Chris Pim ? I am yet to submit an app to Play Store that has IAP. https://quality.embarcadero.com/browse/RSP-35834 I haven’t gotten that far due to the emoji colouring bug but it does sound like it needs fixing anyway so I’d recommend logging in QC. Share this post Link to post
Chris Pim 34 Posted December 2, 2021 I've finally managed to upload my app from D11 (Billing v4) to the Play Store. The manifest includes both the activity and meta-tag entry and I removed the legacy BILLING permission as described above. The app works perfectly when tested locally and through the Alpha and Beta test channels on the Play Store. I can successfully make purchases, restore them etc. I've implemented subscriptions and they work, renew and cancel correctly. However... as soon as the same build is promoted to Production, things go wrong. Every user who tries to make a purchase gets a "Error 5, DEVELOPER_ERROR" response from the PurchasesUpdated listener. These are likely be users new to the app rather than existing users who have upgraded (they usually buy pretty quickly if they're going to). From the logs I've captured, it's showing the purchase pop-up fine (launchBillingFlow returns OK) but when they actually try to buy the product, it shows the DEVELOPER_ERROR described above. I'm still investigating this and will post in here once I've figured it out. Almost all posts about that error in Google say that Error 5 is returned much earlier in most cases (e.g. when querying the inventory or initialising the store) but those return OK for me. They say it usually appears if the parameters passed into the purchase call are wrong (they're correct) or bad signing (it's correct and worked for all previous builds). I found the following which is exactly the same situation as I'm facing: https://issuetracker.google.com/issues/204353360 They solved it by adding the legacy BILLING permission back in, so maybe that's something. I've successfully uploaded a new build to Production with this permission turned on along with the meta-tag and activity, and it was accepted no problem. It will be a few days before the new release is reviewed and enough users get it to capture anything useful, but once I have some news I'll report back. Hopefully that's all it needs otherwise I'm really at a loss over this. If it works I'll add this to the QC report about the missing meta-tag. Share this post Link to post
Dave Nottage 557 Posted December 2, 2021 6 hours ago, Chris Pim said: They solved it by adding the legacy BILLING permission back in, so maybe that's something. I've successfully uploaded a new build to Production with this permission turned on along with the meta-tag and activity, and it was accepted no problem. I thought that's something that what was causing problems before? Weird. Anyway, good to know, and thanks for the update Share this post Link to post
Chris Pim 34 Posted December 7, 2021 After running my changes live for a few days, it looks like adding the permission back in has fixed the developer_error issue. I have absolutely no idea why as the official docs say you shouldn't need it. If anyone else has issues with Android billing from Delphi 11, I suggest you leave the legacy Vendor Billing permission turned on and see if it help you too. 1 Share this post Link to post
Bilcan 0 Posted December 30, 2021 Hi, I have a Delphi 10.4.0 android software that has In-App products and worked fine. After I upgraded Delphi v11, I have done everything people mentioned here and uploaded the app to the Play Store (Internal, Alpha, Beta test, and production). I did not get any warning for Billing Version. But application can't retrieve In-App products from Google Play. What can be the reason? What can I do to solve the problem? <uses-sdk android:minSdkVersion="23" android:targetSdkVersion="30" /> <uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" /> <uses-permission android:name="android.permission.ACCESS_WIFI_STATE" /> <uses-permission android:name="android.permission.CAMERA" /> <uses-permission android:name="android.permission.INTERNET" /> <uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> <uses-permission android:name="android.permission.READ_PHONE_STATE" /> <uses-permission android:name="com.android.vending.BILLING" /> <uses-permission android:name="android.permission.VIBRATE" /> <uses-permission android:name="android.permission.WAKE_LOCK" /> <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> <meta-data android:name="com.google.android.play.billingclient.version" android:value="4.0.0" /> <activity android:name="com.android.billingclient.api.ProxyBillingActivity" android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|uiMode|screenSize|smallestScreenSize" android:theme="@android:style/Theme.Translucent.NoTitleBar" /> <receiver android:name="com.embarcadero.rtl.notifications.NotificationAlarm" /> Share this post Link to post
Chris Pim 34 Posted December 31, 2021 That all looks correct. Are you getting an errors from any of the error callbacks in the iAP component when you QueryProducts? Share this post Link to post
Chris Pim 34 Posted January 1, 2022 If you’re getting no errors from the component, then I would check logcat as the Play services may be raising errors which would appear in the device logs. Failing that, I would suggest debugging your app in the IDE and browsing into the iAP sources to see if you can spot where your calls may be being terminated before the Play services are invoked due to something you’ve missed in your setup of the store. It doesn’t sound like you’re doing anything wrong and if it worked in earlier Delphi versions it should be fine, but without seeing your code for how you’re using the iAP component it’s hard to offer more suggestions. Share this post Link to post
Bilcan 0 Posted January 1, 2022 I figured out the problem. I used to pass TIAPProductList to another list and start a timer to list the products. (Because of an earlier bug of XE6) Now I removed that part and list the TIAPProductList when the event triggered. Everything working fine at the moment, Thank you Chris for all the advices. Share this post Link to post
Chris Pim 34 Posted January 1, 2022 No problem, glad I could help and it’s really good to hear it’s now working for you. Good luck with your app! Share this post Link to post