How to get Google PlayStore country in Adobe Air -


we having app uses milkmangames native extension inapp purchases in android app. problem can not find out price , currency of product user bought. price google comes in localized format due bad implementation @ side guess. price can 5 dolars or 10 kroner, impossible know whether dollars or canadian dollars, swedish kroner or norway kroner.

other option work me getting market user using, can not seem find out way in air.

i ran across same issue trying find way raw price data , country code track iap data better. apparently there long-standing feature request native google iab extension support this: https://code.google.com/p/marketbilling/issues/detail?id=93

thankfully, as3 provides interface information (as native android if have own ane experience). below sample in as3 should able want based on information ane in localized price formatting.

var price:string = "$4.99"; var defaultlocaleid:localeid = new localeid(localeid.default); var currencyformatter:currencyformatter = new currencyformatter(defaultlocaleid.name); var currencycode:string = currencyformatter.currencyisocode; var currencysymbol:string = currencyformatter.currencysymbol; var priceclean:number = currencyformatter.parse(price).value; trace( "currency test: price: " + price + " | currency code: " + currencycode + " | symbol: " + currencysymbol + " | priceclean: " + priceclean ); 

the expected output myself (in us) below:

currency test: price: $4.99 | currency code: usd | symbol: $ | priceclean: 4.99

hope helps.


Comments