question

bisqray avatar image
bisqray asked

ItemDataAsyncTask return successful but with non numeric pricing info

Hello, Our app has been live and in app purchases working fine. Then we submitted an update that Amazon said immediately crashed but we could not duplicate. The logs they sent said there was a number format exception when getting item price data. So we put in the code below to catch non-numeric data coming back from the market. This worked fine running against the test market SDK so we submitted the app and amazon approved it. But now that the updated app is live on the market the error catch code below is triggering for every single item. In other words the live market call to ItemDataAsyncTask returns successful but the price information cannot be converted to a double. However running the app against the test market SDK still works fine. We know that the in app items are configured on the market correctly because you can still actually buy the item if you ignore the errors our app is popping up because the conversion failure. Is this a market problem or can someone see what we are doing wrong? String price = i.getPrice();                     if( price.length()>0 )                     {                         Double d = null;                         boolean failed=false;                         try                         {                             d = Double.parseDouble(price);                         }                         catch(NumberFormatException e)                         {                             e.printStackTrace();                             failed=true;                             maPrices[x] = "Unavailable";                                                     }
iap
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

bisqray avatar image
bisqray answered
Figured out the problem. In our json test file that contains the IAP data, we where putting the price as 0.99 (just like the price we enter into the Amazon Portal when we configure the real IAP data) But it turns out that when the real market returns data it returns it with the currency symbol (like $0.99) That's why our test for data type double was failing. Lesson: in your json file be sure to enter $0.99 as the price
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Samuel@Amazon avatar image
Samuel@Amazon answered
Hi bisgray, You can also find the price value in the method getPrice(), where it return price along with currency code. For this, you need to parse the price value to use. It's good to know that you are able to solve the issue. I hope this would help others in the forum. Thank you :)
10 |5000 characters needed characters left characters exceeded

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.