question

Jose Aaron Lopez Garcia avatar image
Jose Aaron Lopez Garcia asked ·

PurchasingListener doesn't get called.

Hi I'm trying to add Amazon's IAP to my game and so far I can get the testing (sandbox) environment to work. My game is written in C and I call a Java method to start the consumable purchase with PurchasingService.purchase(sku). This all works fine and the amazon box appears and all perfect, except for the fact that I need to stop the game until the amazon IAP is done, and the only way I can know it's done is by using the PurchasingListener callback, however, the callback is never called!

I have added a few prints in the call back handler onPurchaseResponse and nothing at all shows up in logcat, I do however see this:

D/d       (31768): In App Purchasing SDK - Sandbox Mode: PurchasingListener registered: com.hangovergames.minefieldmadness.MinefieldMadness$MyPurchasingListener@41e428f0

But nothing else, neither from the IAP SDK or from my onPurchaseResponse callback. This of course leads the game into an infinite loop as it keeps waiting for onPurchaseResponse to set a boolean flag to false, but this method never gets called, at all.

iap
10 |2000 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.

Jose Aaron Lopez Garcia avatar image
Jose Aaron Lopez Garcia answered ·

I just realized this is not the correct place for this question, it was late at night and I was tired and just posted in the first place I saw. If a moderator can move this to the correct section I would appreciate it.

Also, to add more info, I compiled and tested Amazon's sample consumable app and that one also seems to not work. It doesn't detect that I have bought an orange, which means something is preventing callbacks to be called as expected.

10 |2000 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.

Jose Aaron Lopez Garcia avatar image
Jose Aaron Lopez Garcia answered ·

Update: I managed to fix the problem. The online documentation says that you have to include this into your AndroidManifest.xml file:

But this is completely incorrect, an action doesn't have a permission tag, so I fixed it by moving the permission tag to the reciever, like this:

Everything now works as intended and my game is getting ready to be published.

2 comments
10 |2000 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.

The code descriptions are no longer available in your comment. Could you please clarify on the problems with the documentation on the manifest file? Still experiencing a similar problem.

0 Likes 0 ·

Please update your post describing how where exactly you moved permission tag to solve the issue that PurchasingListener doesn't get called.

0 Likes 0 ·
NickG@Amazon avatar image
NickG@Amazon answered ·

Thanks for the information, I'll look into getting the documentation updated for that section to make this process easier for future developers.

2 comments
10 |2000 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.

Hello, the code descriptions are no longer available in Jose's comment. Could you please clarify the problems the documentation used to have with the manifest file? Still experiencing a similar issue.

0 Likes 0 ·

4 years passed but you still haven't fixed the issue! In-app purchases totally don't work! Official documentation is incorrect! Sample projects don't work! Every employee received $400,000 for 4 years and what are the results? That's just unbelievable.

0 Likes 0 ·
Levon@Amazon avatar image
Levon@Amazon answered ·

The solution would be to include the receiver and have the NOTIFY action and permission set. Open your AndroidManifest.xml file, and add the following (you can place it after all of your <activity> entries, just before </application> end tag:

<!-- Amazon IAP v2.x -->
<receiver android:name = "com.amazon.device.iap.ResponseReceiver">
  <intent-filter>
    <action android:name = "com.amazon.inapp.purchasing.NOTIFY" 
      android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY" />
  </intent-filter>
</receiver>
1 comment
10 |2000 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.

It still doesn't work. Android Studio writes that this permission is incorrect and may be removed from AndroidManifest.xml file. Where actually should we place this code?

0 Likes 0 ·
Dmitry avatar image
Dmitry answered ·

I have the same problem. Official samples and official documentation are not correct since 2015! In-app purchases don't work. PurchasingListener doesn't get called. NOTIFY Permission in the AndroidManifest.xml file is incorrect. But where should we place it instead???

10 |2000 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.

Wanja99 avatar image
Wanja99 answered ·

From Android Developer Guide it should work like this:

https://developer.android.com/guide/topics/manifest/receiver-element

<receiver>

syntax:
<receiver android:name="string" android:permission="string">
. . .</receiver>


7 comments
10 |2000 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.

I tried LAT with a modified Manifest where I removed android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" from the <action> tag to the <receiver> tag, but unfortunately the IAP calls don't work. I'm using the Adobe Air ane for implementing IAP. After reading several posts, checking my setup several times, I don't know what else I could do to make IAP work in LAT :-(

0 Likes 0 ·

Now LAT works for me with the modification of the Manifest. I uploaded a debug.apk for testing with logs.

0 Likes 0 ·

And what do you put to android:name - "com.amazon.device.iap.ResponseReceiver" or "com.amazon.inapp.purchasing.NOTIFY"?

0 Likes 0 ·

This I let like it is, only move the permissions up to reciever like this:

<receiver android:name="com.amazon.device.iap.ResponseReceiver" 
	android:permission = "com.amazon.inapp.purchasing.Permission.NOTIFY">
0 Likes 0 ·

And for me it worked with a debug.apk, now I tried with a release.apk there the IAP calls didn't work, I have to look in it now. Hope this implementation will get to an end shortly :/

0 Likes 0 ·
Show more comments
Prashant@Android avatar image
Prashant@Android answered ·

Hi,
We are facing a blocking issue and need immediate help. We are working on an App for firestick TV and found the issue with amazon in app purchase. The problem is given below:

PurchasingListener is working during sandbox testing, however when we are deploying the app apk to live environment (live test environment of amazon), PurchasingListener stops working.

The code snipped is given below:

<receiver android:name="com.amazon.device.iap.ResponseReceiver" >
<intent-filter>
<action
android:name="com.amazon.inapp.purchasing.NOTIFY"
android:permission="com.amazon.inapp.purchasing.Permission.NOTIFY" />
</intent-filter>
</receiver>

Looking for your help as we are stuck here.

10 |2000 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.