question

Mike M avatar image
Mike M asked

null pointer for onPurchaseUpdatesResponse in store

We've just released our first IAP app and we're getting some crash reports that suggest we're getting a null pointer passed into onPurchaseUpdatesResponse. We're wondering what we might be doing wrong to trigger this, or if this is a known normal behavior we should guard against? Next, when we did the purchase, we didn't get the callback to show the item was installed. Trying to purchase again correctly detected the previous purchase and installed the item as expected. Last but not least, our code for detecting previous purchases on startup with PurchasingManager.initiateGetUserIdRequest() doesn't seem to be fired. I.e., if I uninstall the app, then reinstall, it doesn't auto-detect. This was something that worked fine with the AmazonSDKTester. In the live store, I have to pretend to purchase, be informed that I have already purchased, and then it installs correctly. Has anyone else seen this sort of behaviour? It all worked so well with the AmazonSDKTester... Any advice is welcomed, thanks!
iap
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi mattsenft, We are looking into it and we will update this thread once we got an update. Thank you.
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Mike M avatar image
Mike M answered
An update for others: 1) We updated to use the latest Amazon IAP library, 1.0.5. 2) We updated our code to use the Button sample which uses async for handling the callbacks / new calls instead of the "quick start" guide which does not. 3) We added null checks around every single pointer we received back from the Amazon callbacks. This combination fixed the previous purchase problem for Kindle Fire (and hopefully purchase... this was harder to test as we had already purchased). However it seems the Kindle Fire HD still needs to "purchase" twice before we get the needed callbacks to install. I suspect that only (1) was necessary. Hope this helps...
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.