question

jltmm avatar image
jltmm asked

onGetUserIdResponse never get called

Hi, I am unable to get onGetUserIdResponse even though i followed this post and verified all steps. https://forums.developer.amazon.com/forums/thread.jspa?messageID=3160ౘ I am not using any amazon device, i am using a normal Andriod device which has Amazon client installed and logged in with my account
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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Jitmm, Thank you for your post. Are you testing ButtonClicker sample app comes with sdk package? Could you please check that you have installed AmazonSDKTester.apk (from Apps-SDK/InAppPurchasing/tools folder) in the tharget device? If you have installed it, you are supposed to get "DefaultTestUser" as value of user id in GetUserIdResponse. If you are testing this in your app, can you share the related code snippet? You can raise a ContactUs ( https://developer.amazon.com/help/contactus.html) if you dont want to share the code publicly in forum. Please mention this thread url ( https://forums.developer.amazon.com/forums/thread.jspa?threadID=1077&tstart=0) in the contact us and one of our support engineer would be able to help you shortly.
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.

jltmm avatar image
jltmm answered
Hi Thanks for your prompt response, my issue was solved with having a device OS greater than 2.3.3. I am facing another issue, i have installed amazon client and amazonSDKTester and logged into amazon client with my amazon credentials. I have my App live on Amazon AppStore, and also i have a purchasable Entitled Content which is live.i am ttrying to do PurchasingManager.initiatePurchaseRequest(MY_SKU); after calling this i am getting message like PurchaseRequestStatus:INVALID_SKU I gave the correct SKU which was present in app store. Note: The APK i am running is not the one in app store, i am developing and running in debug mode(is their any concern about apk mismatch from app store?)
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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Jltmm, Thank you for your post. The API libraries will detect whether your build has been published through the Distribution Portal. If it has, the API will exchange data with the Amazon Client. If the API detects that the app has not been published through the Distribution Portal, the API will exchange data with SDK Tester. This ensures that you will be able to use the same codebase for testing that you intend to submit for publication. So you are using debug build what is not submitted to distribution portal and that's the reason you are getting INVALID_SKU. As you are running the app in IAP sandbox, could you please check your amazon.sdktester.json file saved in sdcard whether the target sku is defined properly? We can determine if an IAP is using SandBox mode based on the Boolean parameter "isSandboxMode" of callback method onSdkAvailable(). As per the documentation, onSdkAvailable(boolean isSandboxMode) - This callback is invoked once you register your PurchasingObserver with the PurchasingManager - This method tells you if the Purchasing Framework is running in sandbox mode with test data, or in production mode with real data - If your app is downloaded via the Amazon Client, isSandboxMode will return false - The initiating method should be called within the onStart() lifecycle method If an IAP is running in SandBox mode, then the isSanboxMode Boolean will return true. Please refer below link for better clarity https://developer.amazon.com/sdk/in-app-purchasing/documentation/testing-iap.html#How
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.

jltmm avatar image
jltmm answered
Thankyou, Will try the above mentioned cases and let u know for further assistance.
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.

jltmm avatar image
jltmm answered
Hi Sujoy, Great Support.I am able to perform sandbox testing successfully. i have some more couple of questions. Please go through present scenario of my app: I have an app with an activity consisting of a listview which is populated with some paid content. On clicking of any paid item i will start another activity called details activity which shows content description, rating, Image etc. I will be passing my SKU (like com.example.samplesku) while starting my details activity intent. I have two buttons in my details activity for two different functionalities 1) Buy Content(Entitled product) 2)Subscribe cotent (Subscription product). on clicking of respective button i will go through all the flow for IAP. Things i am able to perform via sandbox testing: 1) After clicking my buy button i am able to see amazon SDK Tester dialog of description , price etc etc. 2) After clicking the purchase button in amazon SDK Tester dialog purchase is done successfully. Things i want to implement in my app: Q 1) Purchase button in my details activity should be available for 1st time only. that means second time if i call the detail activity i should not see purchase button , instead i should see content already purchase. my question is how amazon IAP can be used to store the purchased content locally.
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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi Jltmm, Thank you for your post. You are supposed to call PurchasingManager.initiatePurchaseUpdatesRequest in the app startup. Then you would receive call back onPurchaseUpdatesResponse in your derived class implementation of BasePurchasingObserver. On a successful response, a response object is passed which contains the request id, request status, a set of previously purchased receipts, a set of revoked skus, and the next offset if applicable. If a user downloads your application to another device, this call is used to sync up this device with all the user's purchases. So you are going to have a list of skus what user owns. You could have a table in sqllite where you are going to maintain the purchased items skus. You could sync your table in every app start up in onPurchaseUpdatesResponse callback. You have to update that table in onPurchaseResponse also after some one buys the entitlement or subscription. While rendering the view, you could query your table whether the current sku has been bought or not. Hope this helps.
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.