v2 Entitlement Sample Sandbox Mode: Error in sendResponse: java.lang.NullPo
Have attempted v2 Entitlement Sample - d/l SDK on Wed 2014.07.30 v2 Entitlement Sample Sandbox Mode: Error in sendResponse: java.lang.NullPointerException InAppPurchasing\2.0\samples\SampleIAPEntitlementsApp Compiled SDK source unchanged Verified amazon.sdktester.json in mnt/sdcard/ and string id matched in MySku.java "com.amazon.sample.iap.entitlement.level2" Manifest contains element receiver node - v2 receiver android:name="com.amazon.device.iap.ResponseReceiver" Donwloaded new Amazon App Tester per:
http://forums.developer.amazon.com/forums/thread.jspa?threadID=3735&tstart=0 Removed v1 SDK tester per: "No value for priceJson"
http://forums.developer.amazon.com/forums/thread.jspa?threadID=3787&tstart=0 Unable to locate suitable setup instructions for any of the IAP samples Hard reboot of Kindle. Reboot of PC and fresh restart Eclipse 3.8 07-30 20:41:17.553: D/c(4018): In App Purchasing SDK - Sandbox Mode: handleResponse 07-30 20:41:17.553: D/SampleIAPEntitlementsApp(4018): onGetUserDataResponse: requestId (1d3ed972-8609-4bc1-9a4f-2e39a6a499d4) userIdRequestStatus: SUCCESSFUL) 07-30 20:41:17.553: D/SampleIAPEntitlementsApp(4018): onUserDataResponse: get user id (l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=, marketplace (US) 07-30 20:41:17.560: D/c(4018): In App Purchasing SDK - Sandbox Mode: handleResponse 07-30 20:41:17.560: I/c(4018): sendGetPurchaseUpdates with user idl3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU= 07-30 20:41:17.560: I/c(4018): send PurchaseUpdates with user id:l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=;reset flag:false, local cursor:0, parsed from old requestId:GET_USER_ID_FOR_PURCHASE_UPDATES_PREFIX:0:e9d3c53d-1f1e-41d3-9665-8a07a0e8f5ff 07-30 20:41:17.779: D/c(4018): In App Purchasing SDK - Sandbox Mode: handleResponse 07-30 20:41:17.779: I/c(4018): Offset for PurchaseUpdatesResponse:0 07-30 20:41:17.795: D/SampleIAPEntitlementsApp(4018): onPurchaseUpdatesResponse: requestId (5e50bc9a-de0f-4c33-a40f-9b4d4aac7d9d) purchaseUpdatesResponseStatus (SUCCESSFUL) userId (l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=) 07-30 20:41:17.795: D/SampleIAPManager(4018): getEntitlementRecordBySku: userId (l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=), sku (com.amazon.sample.iap.entitlement.level2) 07-30 20:41:17.803: D/SampleIAPManager(4018): getEntitlementRecordBySku: no record found 07-30 20:41:17.810: E/c(4018): In App Purchasing SDK - Sandbox Mode: Error in sendResponse: java.lang.NullPointerException Unable to locate method getEntitlementRecordBySku() in SampleIAPManager.java as LogCat indicates Also note that the 'Buy Acces to Level 2' is not hilited, so only option is to close the SDK sample
Hi robin, Thank you for your feedback. I confirmed the NullPointerException in the log. I have forwarded it to the engineering team to review. However, I was unable to reproduce your issue. The sample app is functioning even with the NullPointerException in the log. Can you check the onProductDataResponse in the log? It should look something like this: D/SampleIAPEntitlementsApp(11978): onProductDataResponse: RequestStatus (SUCCESSFUL) D/SampleIAPEntitlementsApp(11978): onProductDataResponse: successful. The item data map in this response includes the valid SKUs D/SampleIAPEntitlementsApp(11978): onProductDataResponse: 0 unavailable skus Thanks
Eric, Thank you for taking a look. I re-ran the app today, Sat Aug 02, restart Kindle and reboot PC and seem to get the same response as you did. My instance however, hangs immediately after the exception, with the button in an inactive state. 08-02 11:49:20.650: D/c(10168): In App Purchasing SDK - Sandbox Mode: sendPurchaseUpdatesRequest/sendGetUserData first:GET_USER_ID_FOR_PURCHASE_UPDATES_PREFIX:0:aaceb7d0-66c2-4240-a551-dd7c34787450 08-02 11:49:20.814: D/libEGL(10168): loaded /system/lib/egl/
libGLES_android.so 08-02 11:49:20.814: D/libEGL(10168): loaded /vendor/lib/egl/
libEGL_POWERVR_SGX540_120.so 08-02 11:49:20.837: D/libEGL(10168): loaded /vendor/lib/egl/
libGLESv1_CM_POWERVR_SGX540_120.so 08-02 11:49:20.837: D/libEGL(10168): loaded /vendor/lib/egl/
libGLESv2_POWERVR_SGX540_120.so 08-02 11:49:20.978: D/OpenGLRenderer(10168): Enabling debug mode 0 08-02 11:49:22.916: D/SampleIAPEntitlementsApp(10168): onResume: call getUserData 08-02 11:49:22.916: D/c(10168): In App Purchasing SDK - Sandbox Mode: sendGetUserDataRequest 08-02 11:49:22.939: D/SampleIAPEntitlementsApp(10168): onResume: getPurchaseUpdates 08-02 11:49:22.939: D/c(10168): In App Purchasing SDK - Sandbox Mode: sendPurchaseUpdatesRequest/sendGetUserData first:GET_USER_ID_FOR_PURCHASE_UPDATES_PREFIX:0:0840a087-949e-48a3-8bf0-68ec5df21096 08-02 11:49:23.087: D/c(10168): In App Purchasing SDK - Sandbox Mode: handleResponse 08-02 11:49:23.087: D/SampleIAPEntitlementsApp(10168): onProductDataResponse: RequestStatus (SUCCESSFUL) 08-02 11:49:23.087: D/SampleIAPEntitlementsApp(10168): onProductDataResponse: successful. The item data map in this response includes the valid SKUs 08-02 11:49:23.087: D/SampleIAPEntitlementsApp(10168): onProductDataResponse: 0 unavailable skus 08-02 11:49:23.087: D/c(10168): In App Purchasing SDK - Sandbox Mode: handleResponse 08-02 11:49:23.095: D/SampleIAPEntitlementsApp(10168): onGetUserDataResponse: requestId (cf6ce3c5-ee14-42dd-a52a-4500b0c08202) userIdRequestStatus: SUCCESSFUL) 08-02 11:49:23.095: D/SampleIAPEntitlementsApp(10168): onUserDataResponse: get user id (l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=, marketplace (US) 08-02 11:49:23.095: D/SampleIAPManager(10168): getEntitlementRecordBySku: userId (l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=), sku (com.amazon.sample.iap.entitlement.level2) 08-02 11:49:23.095: D/SampleIAPManager(10168): getEntitlementRecordBySku: no record found 08-02 11:49:23.095: E/c(10168): In App Purchasing SDK - Sandbox Mode: Error in sendResponse: java.lang.NullPointerException 08-02 11:49:23.095: D/c(10168): In App Purchasing SDK - Sandbox Mode: handleResponse 08-02 11:49:23.103: I/c(10168): sendGetPurchaseUpdates with user idl3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU= 08-02 11:49:23.228: I/c(10168): send PurchaseUpdates with user id:l3HL7XppEMhrOGDnur9-ulvqomrSg6qyODKmah76lJU=;reset flag:false, local cursor:0, parsed from old requestId:GET_USER_ID_FOR_PURCHASE_UPDATES_PREFIX:0:aaceb7d0-66c2-4240-a551-dd7c34787450 08-02 11:49:23.259: D/c(10168): In App Purchasing SDK - Sandbox Mode: handleResponse I reviewed: Under 'Entitlement' 1. Bring the Purchase Window to the foreground by clicking on the Buy Access to Level 2 button.
https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/implement-consumables-entitlements-and-subscriptions-in-iap-2.0#5.%20Building,%20Installing,%20and%20Running%20the%20Sample%20App%20in%20Sandbox%20%28Test%29%20Mode but unable to advance as my instance is created with the button in an inactive state.
Hi robin, Thanks for the update. The log shows onProductDataResponse was successful, so I would expect the buy button to be available. Can you tell me which Kindle model you are testing with? Can you try force-closing & clearing app data of the sample app and see if that help? If the problem persist, try put some logging in setLevel2Availbility() inside MainActivity.java. That should tell us why the buy button is not enabled. Thanks
KF HD 7 2nd gen KFTT Current sync version 7.4.9 Could you please explain what exact steps you would like me to perform for a 'force-closing' and what app data exactly, and steps to remove, as the app isn't apparently loading, indicated by the early termination of log cat entries. The log ends abruptly a few lines after 'sendResponse: java.lang.NullPointerException' as indicated by both listings previously posted. The only way I am able to currently terminate is the left facing arrow on the SoftKey input panel, and have even tried to hold the power button in for ten seconds to force a cold reboot. After re-reading this post, IAP v2 is now not an immediate priority for my app submission requirement(s).
https://forums.developer.amazon.com/forums/thread.jspa?threadID=3826 I will however continue to provide detail for the SDK team on a time available basis in order to locate what was omitted from the recent v2 SDK deployment. I'll put some effort into peppering those functions with debug log entries this weekend, or if there is existing debug function sections available that I may cut-n-paste into the SDK example, or the entire MainActivity.java file or others, I could compile and run that for the SDK team. I am compiling with the v2 SDK files (July 30 d/l) unedited at this time.
Hi robin, You can follow these steps to force close an app and clear it's app data: 1. Swipe down from the top of the screen to show Quick Settings 2. Select More... > Applications > Installed Applications 3. Select "SampleIAPEntitlementsApp" in the list 4. Tap Force stop 5. Tap Clear Data Please also double-check that you are running the latest version of Amazon App Tester, version 18.104.22.168 If that doesn't work, please try the following apk. It is the same sample app, but with additional logging and status message.
http://tinyurl.com/mkcxd9u You can side-load it onto your Kindle through this command: adb install Here is a un-modified copy of the json file from the sample:
http://tinyurl.com/orxye62 Here is the source code in case you are interested:
http://tinyurl.com/q4wed7a Regarding the NullPointerException, I confirmed with the SDK team that it is safe to ignore. It does not impact the functionality of the sample app. Thanks
Hi robin, Thanks for the feedback :) Can you check the following settings in App Tester? 1. Launch Amazon App Tester 2. Select In-App Purchasing API > 2. API Response Settings 3. Ensure "Default" is selected for all 4 API options I suspect "SUCCESSFUL" was selected for the GetProductData API, which would cause App Tester to ignore the content of the .json file and return the selected value. So when onProductDataResponse is called on the sample app, it's status would be successful, but the buy button would not light up because the list of available SKUs is empty (since it ignored the .json file). Thanks
Although I had previously launched the new AAT, I had not made changes or selected any options. After a bit of testing, I'll think you'll agree that, making selections there isn't what is causing the SDK sample button to stay un-hilited. and, your assumption was correct, 'Successful' was selected. But not by me. so I Uncheked 'Successful' and set to 'Default' Now the SDK Entitlement app is rendering Buy Access to Level 2 button still continues to be un-hilited Level 2 Enabled label background is now in yellow Status: 'Product is available and already purchased' The strange part: How could this show 'already purchased' when the button has always been hilit and unselectable? (therefore I could never have made a purchase attempt) I cleared the app data using the totally awesome instructions previously given ;-) I set the AAT selection back to 'Succuessful', re-ran the app and it does as expected, return to greyed out and button un-hilit state along with 'Product is not available' I cleared the app data yet again, verifying the AAT has four 'default' settings indicated, but the SDK sample still loads with the button greyed out in an un-selectable state. I could still try peppering the code with more log statements. Other ideas? Send me a KF HDX 9 to see if it is hardware related? Q: During the AAT testing phase, dose the SDK app or AAT make requests out to the AWS web service servers to perform authentication-verification causing data on the cloud server to somehow corrupt the app launch settings?
Hi robin, There are 2 conditions required in order for the buy button to light up in this sample app. 1. The IAP item is defined in the .json file 2. The IAP item has not been purchased before After you changed the API options to "Default", you saw the label with a yellow background, and the buy button remain disabled. That is expected due to condition #2 above. The reason is that, for entitlement, user can only purchase the item once. So the app should check the purchase status and prevent the user from purchasing the same item again.
https://developer.amazon.com/public/apis/earn/in-app-purchasing/docs-v2/types-of-purchases I believe the following steps should get you un-blocked: 1. Launch Amazon App Tester 2. Verify again "Default" is selected for all 4 API options 3. Select 3. Manage Transactions 4. Select Delete All 5. Force-close and clear app data of the sample app That should reset everything back to default. Regarding your last question, both the sample app and Amazon App Tester do not require Internet connection to operate. Testing can be done completely offline. Thanks
Good guess, but that wasn't it. . . . I do however have a few ideas. Quick recap: I purchased KF HD7 2nd around Nov 2013. OS 7.4.6? Started IAP v1.03 in Jan 2014. Never got SDK entitlements to work and some process corrupted device. First level Amazon support insisted I do a factory reset, despite pleas concerning all the current development would be lost. Against my wishes, did the reset and all development did get whacked along with all my Silk settings. Rats! [insert better actual expletive] This time got the IAP v1.03 SDK consumable to work. Put it aside to explore WebApps instead.
https://forums.developer.amazon.com/forums/thread.jspa?messageID=6270 On going struggles with WebApps see forum under my name, then on to explore and live with limitations with Html5 hybrid apps. Again see hybrid forum. I also remember that when I worked with Html5 localStorage from an Android WebView, that sometimes the entire store would become corrupt when testing with WAT v1 but I believe that was to have been fixed with WAT v2 2014.06.27 which is what I have installed now.
https://forums.developer.amazon.com/forums/thread.jspa?messageID=7558ᶆhttps://forums.developer.amazon.com/forums/message.jspa?messageID=11491#11560https://forums.developer.amazon.com/forums/thread.jspa?messageID=7541ᵵ Ponder: Does IAP use the same method (Java) to store (file API maybe?) it's local storage similarly to how WAT stores (Java) the Android WebView (Html) window.localStorage? e.g. if so, could the Kindle local store be corrupt? and is there a way to test, as from these post responses, one is unable to view what data is there. In July 2014 saw post that IAP v1.03 was deprecated so attempted to see what surprises would now pop up as KF HD7 now at OS 7.4.9 and hybrid app close to submittal phase. Kept getting JSON error: No value for priceJson Performed the uninstall SDK v1 re-install as specified by link in opening post in this thread
http://forums.developer.amazon.com/forums/thread.jspa?threadID=3787&tstart=0 Then kept getting the Null pointer exception, to which I started this thread. After reading your last post, and as I had never played with the new version 2, and after last week checking in SDK v1 tester noticed there weren't any transaction at all. Bewildered, as I expected to see the consumable as I had 'upgraded' (compiled new proj) the SDK v2 consumable source as a new project. on a hunch, I checked AAT v2 'Managed Transactions' but only the consumable that I had created last week was there. So, now the big question. As you were convinced that there were only two possible alternatives, and deduced that the second would have to be the logical choice, and in response that the AWS servers are not involved (why I asked the question in the first place) data has to be created and stored within the Kindle memory space. So, . . . Why isn't the entitlement transaction shown in the new AAT v2 ? Launching either app button continues to be un-hlited as the suggestion is that both my app and the debug app made available performed identical, could/does means both were detecting the 'entitlement' transaction despite the fact it wasn't to be seen. [*** Incidentally, I also remember this was an additional source of issues the front line support team was unable to answer back in Jan 2014 - why certain things weren't showing up and also brings to mind the myriad of complaints over the last six months of individuals performing installs yet their icons now showing up, sideloaded app files not visible using ES3 and such. Seems the KF HD 2nd is problematic here]
https://forums.developer.amazon.com/forums/thread.jspa?messageID=6490ᥚ My hunches: Corrupt data that infected the memory space of the new AAT during install as I no longer get the 'JSON error: No value for priceJson' after performing the un-install of SDK v1 Shared memory space of AAT v2 and SDK v1 that isn't properly cleared during install? SDK v2 samples containing classes whose instances access shared data space of the older v1 samples? Not sure if the new AAT had a recent upgrade as I didn't check the version until you requested me do so. I double checked to make sure no transactions appeared under SDK v1 'Active Transactions' and only the one consumable transaction was visible under the 'Managed Transactions' of AAT v2, I cleared data from each under more >> settings >> applications >> running apps and then reviewed, but had the same un-hilit button. Unless there are other ideas the team would like me to test, I would like to uninstall both testers and if needed both .apk's. and, no . . . I'm not prepared to perform a factory reset for reasons stated above. But you weren't going to ask me to do that anyway. Right?! Q: Is it possible/advisable to run IAP v1.03 tests using the new AAT v2 tester? Robin