Open GoogleCodeExporter opened 9 years ago
I ran into this issue too with a Galaxy S3 (android 4.2.2). I think it happens
when your activity is destroyed and you dispose the IabHelper. As
queryInventoryAsync runs asynchronously, it doesn't get notified and when it
tries to access mContext, it throws a NullPointerException.
Solution :
Just add
"if(mDisposed) return IABHELPER_UNKNOWN_ERROR;"
before
"// Query purchases
logDebug("Querying owned items, item type: " + itemType);
logDebug("Package name: " + mContext.getPackageName());" line 834.
Original comment by sebastie...@gmail.com
on 30 Jun 2013 at 3:53
Hi Sebastie, sounds good, but: mDisposed does not exist...
Original comment by sleepybu...@gmail.com
on 3 Jul 2013 at 9:19
It does in my version, maybe you should update yours.
Original comment by sebastie...@gmail.com
on 3 Jul 2013 at 10:27
Alright, my bad!
Original comment by sleepybu...@gmail.com
on 3 Jul 2013 at 10:35
Great, hope it helped!
Original comment by sebastie...@gmail.com
on 4 Jul 2013 at 12:10
Thanks, but this is only a workaround. There needs to be a synchronization
between dispose() and the evaluation of the return value of the service call
getPurchases().
Maybe using a Handler ?
Original comment by Andreas....@googlemail.com
on 16 Jul 2013 at 3:55
I didn't quite follow your solution sebastian... how do I update my code to get
the mDiposed boolean? Is that in a new IABHelper release, or did you create it
yourself?
Thanks!
Original comment by AndroidD...@gmail.com
on 17 Aug 2013 at 7:10
The mDisposed boolean as been added in the latest releases, udate yours!
Original comment by sebastie...@gmail.com
on 19 Aug 2013 at 6:26
[deleted comment]
[deleted comment]
[deleted comment]
In latest version there's a method called checkNotDisposed(); that's been used
in some parts of IabHelper to to the same stuff, so probably we must use it
here too.
Original comment by dela...@upptalk.com
on 14 Jan 2014 at 4:53
I also see this in the latest (13/12/13) v3 IabHelper
Original comment by smrtprj...@gmail.com
on 1 May 2014 at 7:20
Still see
Original comment by smrtprj...@gmail.com
on 11 Oct 2014 at 6:29
I think I'm seeing the same bug and I just updated my IABHelper code from the
SDK example
(android-sdk-macosx/extras/google/play_billing/samples/TrivialDrive/src/com/exam
ple/android/trivialdrivesample/util) a few weeks ago. This is the exception I
get:
java.lang.NullPointerException
at com.mypackage.IabHelper.queryPurchases(Unknown Source)
at com.mypackage.IabHelper.queryInventory(Unknown Source)
at com.mypackage.IabHelper.queryInventory(Unknown Source)
at com.mypackage.IabHelper$2.run(Unknown Source)
at java.lang.Thread.run(Thread.java:841)
Original comment by car...@instantbits.com
on 1 Dec 2014 at 5:00
[deleted comment]
[deleted comment]
Thanks Sebastie...Solution worked.
Original comment by cholkerp...@gmail.com
on 9 Aug 2015 at 2:16
Original issue reported on code.google.com by
appsyna...@gmail.com
on 4 Apr 2013 at 7:28