Search code examples
androidgoogle-analyticsin-app-purchasein-app-billingcurrency

How do I get the local Currency Code for my android app?


I'm integrating my android app with Google analytics v4. I'm in Argentina, so my currency code is "ARS", not "USD". I need to specify the local currency code (of any other country), otherwise it sends wrong information. For example, the price tag of an article says it costs "9,32 ARS", if I don't specify the currency code it sends "9,32 USD". Thanks

// Send Item
googleTracker.send(new HitBuilders.ItemBuilder()
    .setTransactionId(purchase.getOrderId())
    .setName(purchase.getPackageName())
    .setSku(purchase.getSku())
    .setCategory("Coins")
    .setPrice(skuDetails.getPriceMicros())
    .setQuantity(1)
    .setCurrencyCode(????)
    .build());

Solution

  • I actually could get it working using this answer here: SOLUTION

    Google added to its API a new field which is "price_currency_code", to getSkuDetails, which allows us to get the currency code of a transaction. You must edit SkuDetails.java as this answer shows.