question

Gautam Verma avatar image
Gautam Verma asked

IlLegal State Exception

From the crash reports provided we have come to know that IILegal State Exception is occurring quite frequently in our App. Stacktrace:- java.lang.IllegalStateException at com.amazon.inapp.purchasing.PurchasingManager.checkObserverRegistered(Unknown Source) at com.amazon.inapp.purchasing.PurchasingManager.initiatePurchaseRequest(Unknown Source) This initiatePurchaseRequest() method is called by our App on Purchasing Manager. But i was not able to find any checkObserverRegistered() method in the Purchasing manager API.( It may be the case that its not public.) It may have happened if the Purchasing Observer is not registered by Purchasing manager but we are registering the Observer in onStart() method of the this Activity so that possibility can be safely ruled out. Can anyone help to know why this is exception is being thrown? what can be other possible reasons?? [i][/i][b][/b][b][/b]
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.

1 Answer

Dixith@Amazon avatar image
Dixith@Amazon answered
Hi Gautam, As you mentioned above, registering the observer in onStart( ) method is a good practice.These are the few scenarios, you might be get illegal state exception error. 1.)You must not register a Purchasing observer before using SDK. 2.)Purchsing Observer is null. (check your purchasing Observer object) Go through the code of ButtonClicker activity App in developer portal. Surely this would help you for implementation of your IAP. Still if you face any issues within your app, Please raise a contact-us( https://developer.amazon.com/help/contactus.html) with your snippet of code. This would help us to fix out the issue. 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.