Search code examples
androidgoogle-playin-app-billing

How can I find out user's google play country?


In my app I have in app billing support, since there is no API to get the price of an item before actually showing the user the buy UI, I am currently thinking on hard coding the price for the in app billing items inside the app.

However the pricing would be different depending on the country, so I would need to find a way to know the country the user is on to show the right price in the app.

I've found that the price the user is shown depends on the country the user selected when creating the Google Play account, so I will need a way to know the country associated to the user's google play account. Does anyone know how to do this?

thanks


Solution

  • Use SkuDetails object and getter for price, it will return you localized price for an item.

    1. Get Inventory object
    2. get SKU detail from it :

      userInventory.getSkuDetails(IabHelper.YOUR_SKU).getPrice();

    More info here - http://developer.android.com/training/in-app-billing/preparing-iab-app.html