Skip to content

Local Currency Information V2 ​

Purpose ​

Optional. gamedreamerLocalInfoV2 queries localized prices for the configured price points in the current Google Play region.

The API reads the configured price points and product mapping, queries Google Play Billing, and returns the result grouped by price point.

Function ​

java
import com.gd.sdk.GDSDK;
import com.gd.sdk.listener.GamedreamerLocalInfoListenerV2;

public static void gamedreamerLocalInfoV2(
        Context context,
        GamedreamerLocalInfoListenerV2 gamedreamerLocalInfoListener)

Parameters ​

ParameterDescription
contextAndroid Context object
gamedreamerLocalInfoListenerGamedreamerLocalInfoListenerV2 callback, in com.gd.sdk.listener

Callbacks ​

onLocalInfo ​

java
void onLocalInfo(HashMap<String, Object> map)

Called when the query succeeds. The outer Map key is a configured business price point such as 0.99; its value is the corresponding price information Map.

onFail ​

java
void onFail(String message)

Called when the query fails. message contains the failure details.

Return Structure ​

json
{
  "0.99": {
    "amount": "33",
    "currency": "TWD",
    "currencySymbol": "$",
    "formattedPrice": "$33.00"
  }
}

Outer Map ​

The outer key is a configured price point such as 0.99 or 2.0. Use it to map the result to an in-game price point. It is not a localized amount or a product ID.

Inner Fields ​

FieldDescription
amountThe numeric store amount without a currency symbol, currency code, grouping separator, or spaces. The decimal separator is always ., and insignificant trailing zeroes are removed.
currencyThe ISO 4217 currency code returned by the store, such as TWD, HKD, or USD. Use this field to identify or record the currency.
currencySymbolThe general currency symbol resolved from the device display Locale. Depending on the language, region, and system version, it may be $, NT$, or TWD, and may differ from the symbol in formattedPrice.
formattedPriceThe complete localized price ready to display, including the store-selected currency symbol, amount, decimal places, grouping separators, and symbol position.

amount, currency, and formattedPrice come from the same store offer. currencySymbol only provides the general symbol for the device display Locale. Do not parse the amount or currency from formattedPrice, or concatenate the symbol and amount yourself.

Example ​

java
GDSDK.gamedreamerLocalInfoV2(this, new GamedreamerLocalInfoListenerV2() {
    @Override
    public void onLocalInfo(HashMap<String, Object> map) {
        Object itemObject = map.get("0.99");
        if (!(itemObject instanceof Map)) {
            return;
        }

        Map<?, ?> item = (Map<?, ?>) itemObject;
        String amount = String.valueOf(item.get("amount"));
        String currency = String.valueOf(item.get("currency"));
        String currencySymbol = String.valueOf(item.get("currencySymbol"));
        String formattedPrice = String.valueOf(item.get("formattedPrice"));

        // Use formattedPrice directly for display, for example "$33.00".
        priceTextView.setText(formattedPrice);
    }

    @Override
    public void onFail(String message) {
        Log.e("Game", "local price query failed: " + message);
    }
});

Recommendations ​

  • Use formattedPrice directly for price UI.
  • If you must arrange the amount and symbol yourself, use amount and currencySymbol, and handle symbol position and spaces yourself.
  • Use currency to identify or record the currency; do not infer it from currencySymbol.
  • Do not use the outer price point as a product ID or look for productId in the V2 result.
  • When onFail is called, do not use incomplete price data. Wait for a successful query before displaying a price.
  • If the query fails, using USD as a fallback is recommended.