Resolving Billing 8.0.0 Callback Issues in Delphi FMX (RAD Studio 13.1 Florence)

Upgrading your Delphi FireMonkey (FMX) Android applications to the latest Google Play Billing Library (v8.0.0) is essential for keeping up with Google Play Console requirements. However, developers frequently encounter an issue where query operations complete without error, but the onProductDetailsResponse callback event never fires. Reverting back to Billing 7.1.1 solves the problem temporarily, but leaves your app vulnerable to future store policy deprecations.

In this guide, we will examine why onProductDetailsResponse stops triggering in Billing 8.0.0 and how to fix it in RAD Studio 13.1 Florence.

Root Causes of the Issue

When migrating from Google Play Billing 7.x to 8.x in Delphi FMX, the silent failure of async callbacks usually stems from two main factors:

  • Java Native Interface (JNI) Garbage Collection & Object Lifetime: In Delphi, when you instantiate a listener locally (e.g., ProductListener := TProductDetailsResponseListener.Create;), the object isn't retained by a strong reference. The Android JNI wrapper garbage collects the native listener proxy before Google Play's asynchronous thread returns the product list.
  • Interface Reference Counting & Interface Types: If the listener field is assigned to a class instance variable rather than a JNI interface type (such as JProductDetailsResponseListener), the interface reference count drops to zero, destroying the callback bridge.

Step-by-Step Solution

1. Hold a Strong Reference to the Listener

Ensure your form or manager class holds a persistent reference to the listener interface. Do not instantiate it as a local variable inside Urunleri_Sorgula.

Add a field to your main form's private section: