fredlala8 / marketbilling

Automatically exported from code.google.com/p/marketbilling
0 stars 0 forks source link

TrivialDrive doesn't stop if billing not supported #95

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
Severial of my users are failing to purchase, the iab service routinely returns 
null pointers where the IABHelper is not expecting nulls. I have had to put 
many catches in the code - but this is stopping users from purchasing.

Current changes i have made are.

queryPurchases - added try catch.
 Bundle ownedItems = mService.getPurchases(3, mContext.getPackageName(),
                      ITEM_TYPE_INAPP, continueToken);
 ownedItems is NULL

querySkuDetails
after
 Bundle querySkus = new Bundle();
        querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuList);
added
        if(mService == null || mContext == null)
        {
          logError("mService == null || mContext==null.");
          return IABHELPER_BAD_RESPONSE;
        }
this appears after a query has started, but a user has backed out of the 
activity before the query is complete, thus mservice or mcontext becomes null 
as dispose has been called.

launchPurchaseFlow
modified sometimes act is null.
         if(act != null)
            {
              act.startIntentSenderForResult(pendingIntent.getIntentSender(),
                                             requestCode, new Intent(),
                                             Integer.valueOf(0), Integer.valueOf(0),
                                             Integer.valueOf(0));
            }else
            {
              result = new IabResult(IABHELPER_UNKNOWN_ERROR, "Unexpected Null Pointer Restart App, Try again.");
              if (listener != null) listener.onIabPurchaseFinished(result, null);

            }
added additional catch as we get other exceptions raised - eg null pointers.
 }catch(Exception e)
        {
          logError("RemoteException while launching purchase flow for sku " + sku);
          e.printStackTrace();

          result = new IabResult(IABHELPER_REMOTE_EXCEPTION, "Remote exception while starting purchase flow");
          if (listener != null) listener.onIabPurchaseFinished(result, null);
        }

startSetup
after the printstacktrace return, otherwise program flow continues and causes 
access violation.
    catch (RemoteException e) {
                    if (listener != null) {
                        listener.onIabSetupFinished(new IabResult(IABHELPER_REMOTE_EXCEPTION,
                                                    "RemoteException while setting up in-app billing."));
                    }
                    e.printStackTrace();
                    return;
                }

added
   public boolean isInAsyncOperation()
    {
      return mAsyncInProgress;
    }

as its usefull to know if an async operation is in progress so you can avoid 
starting another.

OS VERSION:
All relevant for IAB

MARKET/MYAPPS VERSION:
Latest

DEVICE:
Any.

OUTPUT FROM ADB BUGREPORT ATTACHED:
Not caught, can not repeat errors myself, all crashes are on end-user devices 
where logcat is not retrieved in the crash reports.

(Note: The output from "adb bugreport" is required for all bug reports.)

NOTES:
This billing service is buggy, I am about to roll back to v2.

Original issue reported on code.google.com by mat...@winters.org.nz on 14 Jan 2013 at 10:27

GoogleCodeExporter commented 8 years ago
This is probably because billing is not supported on those devices. There is a 
check for that in the sample (see IabHelper.java:228), but it's not stopping 
the application with a helpful error message in that case. Instead, the app 
continues to execute and runs into problems later. I'll fix that. Thanks for 
the bug report.

Original comment by b...@google.com on 5 Feb 2013 at 7:22

GoogleCodeExporter commented 8 years ago

Original comment by b...@google.com on 5 Feb 2013 at 7:22

GoogleCodeExporter commented 8 years ago

Original comment by b...@google.com on 7 Feb 2013 at 11:49

GoogleCodeExporter commented 8 years ago
Fixed

Original comment by b...@google.com on 14 Feb 2013 at 10:42