question

Trey Wilson avatar image
Trey Wilson asked

No response delivered to PurchasingListener with some api calls

While testing our in-app purchasing implementation on a Kindle Fire HDX (3rd gen) and some of the api calls never get response in the PurchasingListener. So it simply won't work as expected as the responses are not delivered to the app. Looking at the device logs, this appears a lot: 04-01 11:37:30.962 D/c ( 8251): In App Purchasing SDK - Sandbox Mode: handleResponse 04-01 11:37:30.962 E/c ( 8251): Error handling response. 04-01 11:37:30.962 E/c ( 8251): java.lang.NullPointerException 04-01 11:37:30.962 E/c ( 8251): at org.json.JSONTokener.nextCleanInternal(JSONTokener.java:116) 04-01 11:37:30.962 E/c ( 8251): at org.json.JSONTokener.nextValue(JSONTokener.java:94) 04-01 11:37:30.962 E/c ( 8251): at org.json.JSONObject. (JSONObject.java:155) 04-01 11:37:30.962 E/c ( 8251): at org.json.JSONObject. (JSONObject.java:172) 04-01 11:37:30.962 E/c ( 8251): at com.amazon.device.iap.internal.a.c.e(SandboxRequestHandler.java:393) 04-01 11:37:30.962 E/c ( 8251): at com.amazon.device.iap.internal.a.c.a(SandboxRequestHandler.java:200) 04-01 11:37:30.962 E/c ( 8251): at com.amazon.device.iap.internal.d.a(PurchasingManager.java:130) 04-01 11:37:30.962 E/c ( 8251): at com.amazon.device.iap.ResponseReceiver.onReceive(ResponseReceiver.java:47) 04-01 11:37:30.962 E/c ( 8251): at android.app.ActivityThread.handleReceiver(ActivityThread.java:2512) 04-01 11:37:30.962 E/c ( 8251): at android.app.ActivityThread.access$1700(ActivityThread.java:145) 04-01 11:37:30.962 E/c ( 8251): at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1292) 04-01 11:37:30.962 E/c ( 8251): at android.os.Handler.dispatchMessage(Handler.java:102) 04-01 11:37:30.962 E/c ( 8251): at android.os.Looper.loop(Looper.java:145) 04-01 11:37:30.962 E/c ( 8251): at android.app.ActivityThread.main(ActivityThread.java:5266) 04-01 11:37:30.962 E/c ( 8251): at java.lang.reflect.Method.invokeNative(Native Method) 04-01 11:37:30.962 E/c ( 8251): at java.lang.reflect.Method.invoke(Method.java:515) 04-01 11:37:30.962 E/c ( 8251): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:826) 04-01 11:37:30.962 E/c ( 8251): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:642) 04-01 11:37:30.962 E/c ( 8251): at dalvik.system.NativeStart.main(Native Method) If we reinstall the SDK tester app, it will start working as expected again. My concern is will this happen in production? What causes this?
iap
10 |5000

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

1 Answer

DougM@Amazon avatar image
DougM@Amazon answered
Hello trizey, If you are using In-App Purchasing 2.0, we would recommend having the Amazon App Tester installed to test your application locally. What the Amazon App Tester does is help simulate your application's communication channel with the Amazon Appstore client once your app is published via our systems as either a Live App Test or when it is submitted for review to become live in the Amazon Appstore. What will happen if the client is not going to be able to send nor receive messages to generate the responses in which you are needing. For more information about this, please review our Testing IAP 2.0 documentation at: https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/testing-iap-2.0
10 |5000

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