Are you sure you are calling store.purchase(sku)? You should see either a similar intent message for the intent ‘com.amazon.testclient.iap.purchase’ or possibly an error if you are calling store.purchase();
-Preston
Are you sure you are calling store.purchase(sku)? You should see either a similar intent message for the intent ‘com.amazon.testclient.iap.purchase’ or possibly an error if you are calling store.purchase();
-Preston
I have found the source of the crashing after cancel or purchase, I was using the code from this site:
http://coronalabs.com/blog/2013/09/03/tutorial-understanding-in-app-purchases/
Near the top of the transactionCallback it checks for Google restoration by calling
if store.availableStores.google and tstate == "purchased" then local timeStamp = utility.makeTimeStamp(transaction.date,"ctime") if timeStamp + 360 \< os.time() then -- if the time stamp is older than 5 minutes, we will assume a restore. print("map this purchase to a restore") tstate = "restored" print("I think tstate is ", tstate) restoring = false end end
The crash was coming from checking store.availableStores since the Amazon IAP doesn’t provide it, i just added a quick if statement around it like this:
if system.getInfo("targetAppStore") ~= "amazon" then if store.availableStores.google and tstate == "purchased" then local timeStamp = utility.makeTimeStamp(transaction.date,"ctime") if timeStamp + 360 \< os.time() then -- if the time stamp is older than 5 minutes, we will assume a restore. tstate = "restored" restoring = false end end end
and everything works just fine. Im not sure if thats the best way to handle it or not but it works…
Also yes I am calling store.purchase(sku) but I think the reason was because it was in a different script that didnt have the store required.
Ok that makes sense, looks like your app was crashing before calling purchase. I am glad you solved your issue, but please do not hesitate to create a new topic or reply to this one if you run into more issues.
-Preston
I do have one quick question. The SKU im using is an entitlement, how do I reset it back to not purchased? everytime i try to purchase it says i already own it.
EDIT: Disregard that, I had a moment, obviously thats what the SDK tester.apk is for =P
You may open the SDK tester and clear the test user’s purchases, or clear the data for the Amazon SDK Tester, whichever is more convenient.
I have been using the SDK tester and everything has been working fine. I don’t have a Kindle but was able to test everything successfully on a Galaxy S4 and a Nexus 7.
The game ran just as it should, and as it does on other platforms, so I’ve submitted it.
However I’ve just had an email from Amazon saying:
“My Game Name” does not successfully launch on Kindle Fire Tablets and Non Amazon devices. Upon launch, the app force closes, crashes, or displays only a black screen.
Does anyone know what could be causing this? If it just said it didn’t work on Kindles that would be one thing, but it says it doesn’t work on Non Amazon devices. I reinstalled a copy locally again just to be sure, and it still works on my devices.
Any ideas?
I have been using the SDK tester and everything has been working fine. I don’t have a Kindle but was able to test everything successfully on a Galaxy S4 and a Nexus 7.
The game ran just as it should, and as it does on other platforms, so I’ve submitted it.
However I’ve just had an email from Amazon saying:
“My Game Name” does not successfully launch on Kindle Fire Tablets and Non Amazon devices. Upon launch, the app force closes, crashes, or displays only a black screen.
Does anyone know what could be causing this? If it just said it didn’t work on Kindles that would be one thing, but it says it doesn’t work on Non Amazon devices. I reinstalled a copy locally again just to be sure, and it still works on my devices.
Any ideas?