I am working on Amazon In app Purchase for Android I want to display the price of the item on the user interface but I am unable to get how to display the price?

There is a method called PurchasingManager.initiateItemDataRequest but I dont know what I need to pass to that method so that it will call the onItemDataResponse and will give the details?

EDIT:

Please see my below Answer.

1

There are 1 answers

0
Goofy On

And Yes Finally after doing lot of research got to know how can i get the price to display below is the procedure:

        Set<String> skuSet = new HashSet<String>();
        skuSet.add("Your sku string here");
        PurchasingManager.initiateItemDataRequest(skuSet);

Now we will are passing the sku to the initiateItemDataRequest , now after this method is called a method called onItemDataResponse in the ButtonClickerObserver class will be called automatically then it will call the ItemDataAsyncTask().execute(itemDataResponse);

where we can update the price in our UI TextView or Button Text, it can be done in this way, just override this method in the ItemDataAsyncTask().

@Override
        protected void onPostExecute(Void result) {
            // TODO Auto-generated method stub
            super.onPostExecute(result);
            baseActivity.updateButtonWithPrice(itemPrice);// here i am setting the price of the Button Text
        }

Note : updateButtonWithPrice(itemPrice) is a method which is with string as args which i have written in my activity.

Hope this will help in the future for others. :)