How to get price of an app for different countries by using in-app purchase in android

1.6k views Asked by At

Suppose my app is on play store available for different countries. As according to the country, app price changes, So I want to fetch app price according to the country. How to do this?

Bundle querySkus = new Bundle();
                querySkus.putStringArrayList(GET_SKU_DETAILS_ITEM_LIST, skuPartList);
                Bundle skuDetails = null;
                try {
                    skuDetails = mService.getSkuDetails(3, mContext.getPackageName(),
                            ITEM_TYPE_INAPP, querySkus);
                } catch (RemoteException e) {
                    e.printStackTrace();
                }

                int response = skuDetails.getInt("RESPONSE_CODE");
                if (response == 0) {
                    ArrayList<String> responseList
                            = skuDetails.getStringArrayList("DETAILS_LIST");

                    for (String thisResponse : responseList) {
                        JSONObject object = null;
                        try {
                            object = new JSONObject(thisResponse);
                            String sku = object.getString("productId");
                            String price = object.getString("price");

                            Log.d("IabHelper", "Test sku = " + sku + " && price = " + price);


                        } catch (JSONException e) {
                            e.printStackTrace();
                        }

                    }

                }

The above code is giving me the price of app according to my country. How will other users from another country get it? Does google play service handles it or do I need to use a different code?If yes then how?

0

There are 0 answers