question

plugmind avatar image
plugmind asked

Details needed on initiateGetUserIdRequest & onGetUserIdResponse

Let's assume my app is live in AppStore. I have 2 questions about getting user id: 1. How long does it take until I get notified with onGetUserIdResponse(...) after calling initiateGetUserIdRequest(...) ? 2. My Kindle Fire is not registered to any Amazon account. Will I be notified with onGetUserIdResponse(...) after calling initiateGetUserIdRequest(...) ? If so what value of GetUserIdResponse object will I get? Will GetUserIdRequestStatus value be SUCCESSFULL? Thanks plugmind
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.

Sujoy@Amazon avatar image
Sujoy@Amazon answered
Hi plugmind, Thank you for showing interest on Amazon IAP. 1. There is no guarantee of response time of initiateGetUserIdRequest as there might be communication between amazon appstore client and server since the user id returned by onGetUserIdResponse is specific to this app across all devices registered. In theory the callback should be called quickly. But there might be delay due to network latency. 2. If user does not register the device with Amazon account, onGetUserIdResponse would never be called in live environment. And there would be a popup after a while of initiateGetUserIdRequest method invoke saying "you must be signed in to the Amazon Appstore to run this app". Hope this helps.
10 |5000

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

plugmind avatar image
plugmind answered
Hi, thanks for the answer. In my app I have a subclass of PurchasingObserver. When creating an object I am passing Application context. I am not sure if IAP API will be able to create a popup if it does not have access to current Activity context. I do not want to pass Activity to a constructor of PurchasingObserver. If I did I would have a memory leak. PurchasingObserver object has a reference to Activity. Reference to this PurchasingObserver is kept by PurchasingManager after calling registerObserver(...). You cannot unregister PurchasingObserver which means that reference to Activity remains in memory even if the Actvity is destroyed. That's why I create PurchasingObserver based on Application context. Basically when my app starts (or UI resumes) I need to detemine current Amazon user id or that there is no username. Since onGetUserIdResponse is not called if device is not registered I am unable to determine that user has unregistered device. What is a format of user id returned by onGetUserIdResponse(...) callback? Is it user email address? If it is not email addres then is there a way to get email address of current Amazon user?
10 |5000

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 Plugmind, Thank you for the post. The user id returned by onGetUserIdResponse is random string and specific to this app across all devices registered for the current user. So for a particular user and particular app the user id would be same for all devices. As I said already, if the device is not registered with an Amazon account, app store client would force the user to close the app by showing a popup over your activity saying "you must be signed in to the Amazon Appstore to run this app" so that no one could proceed to play the app. So you do not have to handle this specific condition in your app. And passing application context to BasePurchasingObserver constructor is also ok the instance of BasePurchasingObserver would stay in the memory as long the app context is alive. Hope I am clear.
10 |5000

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

plugmind avatar image
plugmind answered
Thanks.
10 |5000

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