Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-57700

"Unable to get intent sender from service" on Android devices

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P1: Critical
    • 5.10.0 Beta 2
    • 5.7.0, 5.7.1
    • Purchasing
    • None
    • Qt 5.7.0 Android
    • Android
    • f9378f6f03e8f565e2d080b339ed8d68d22054a0

    Description

      • Qt Purchasing seems to assume a purchases restore operation as soon as the app is launched. In normal conditions I'm able to receive the transactionReady for this purchases.
      • This works on all my test devices, but it is not guaranteed to work on ALL devices. I have tested this extensively on at least two devices and the purchases were being correctly restored upon app start. However, deploying the app to thousands of users I have cases in which it doesn't work. I still couldn't establish a pattern of devices/android versions.
      • On those cases Restore Purchases don't work, and as a result, people try to purchase the same product they have already bought on the past. This fails with the error "Unable to get intent sender from service" because createBuyIntentSender fails with error 7 (RESULT_ITEM_ALREADY_OWNED).
      • createBuyIntentSender should handle the response codes according to their meaning instead of just failing, resulting in a imprecise error.

      I have build my own version of Qt Android and tried to implement the following changes at createBuyIntentSender(String identifier)

      
      int response = bundleResponseCode(purchaseBundle);
      
          if (response != RESULT_OK)
          {
              Log.e(TAG, "Unable to create buy intent. Response code: " + response);
      
              switch (response) {
                  case RESULT_BILLING_UNAVAILABLE: errorString = "Billing unavailable"; break;
                  case RESULT_ITEM_UNAVAILABLE: errorString = "Item unavailable"; break;
                  case RESULT_DEVELOPER_ERROR: errorString = "Developer error"; break;
                  case RESULT_ERROR: errorString = "Fatal error occurred"; break;
                  case RESULT_ITEM_ALREADY_OWNED: errorString = "Item already owned"; break;
                  default: errorString = "Unknown billing error " + responseCode; break;
              };
          
              purchaseFailed(request, FAILUREREASON_ERROR, errorString);
      
              return null;
          }
      

      The problem is that purchaseFailed on the C++ side will need to have product pointer which is associated with the request. Since I'm not totally aware of some details of implementation and still couldn't find a way around.

      In order to reproduce the bug:

      - Use a Google Play account different than the app developer account
      - Launch the app with QtCreator
      - Perform an in-app purchase
      - Delete the app
      - Launch the app with QtCreator
      - Tap to purchase the same item
      
      Output in logcat:
      12-23 16:16:46.914 1207 1299 E QtInAppPurchase: Unable to create buy intent. Response code: 7
      

      This is a SERIOUS bug which leads to people complaining about not being able to use a product they have already payed for...

      I have never had this problem on Qt 5.6 Purchasing.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              esabraha Eskil Abrahamsen Blomfeldt
              sinosoidal Nuno Santos
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes