Introducing Currency Converter!
October 29, 2010 1 Comment
Introducing Currency Converter!
So a couple of days ago I hinted that I was working on a top-secret project. Well, that project is top-secret no more, as Currency Converter is now available for free in the Android market! Currency Converter is a basic application that I originally created in order to practice making Android applications, and to play around with user interface design, in an effort to create a professional-looking Android application. I am pleased to announce that this application ended up being much greater than I originally thought possible. Currency Converter is a extremely data-light application that uses less than 1.5 kilobytes of data every time it refreshes the currency exchange rates. That’s rather impressive, considering the fact that Currency Converter supports 94 different international currencies. The exchange rates are automatically loaded from the Internet in the form of a comma separated value file that contains the latest Google Finance currency rates by using the Google Spreadsheet API, and querying a specially formatted Google Spreadsheet document that I created specifically for this application. In order to minimize data usage, the spreadsheet only contains the current exchange rate of one US dollar to every other supported currency. Because the spreadsheet uses the Google Finance formula function, the spreadsheet is automatically updated with the latest rates. Regularly the Google Finance function is used to retrieve the latest stock quotes, but by inserting “CURRENCY:” into the function, we can use it to convert currency. For example, to convert one US dollar to Euros, we would use: ‘=GOOGLEFINANCE(“CURRENCY:USDEUR”)‘ as our function, where ‘USD’ is the ‘from’ currency’s symbol, and ‘EUR’ is the ‘to’ currency’s symbol. However, adding the full Google Spreadsheet API to the application would add bloat, and that wouldn’t be very good. After all, we only need to retrieve the data, we don’t need to do any server side manipulation or anything. Therefore, I used the next best thing. Google has a feature on their server that allows you to run a basic query on the feed of a publicly published and accessible spreadsheet document. Because I love sharing useful things that I make, the spreadsheet document used by my currency converter is completely publicly accessible, and I have no plans on restricting access in the future. By using the query “SELECT A,B“, we can retrieve all the data in columns A and B of the spreadsheet. Click here to see an HTML representation of the data that query returns. So, we now have a very basic, stripped down version of the spreadsheet that can be accessed without being logged in, but it has a lot of extra data that we don’t need, and it would be annoying to parse out. Maybe it’s possible to optimize the server output even more? Of course it is! Google offers the ability to retrieve any spreadsheet document as a comma separated value file that’s extremely minimalistic and optimized with almost no excess data. In this case, we can simple set the PHP GET parameter called “tqx” to “out:csv“. This results in a much smaller and easier to parse file being returned by the server. Currency Converter is now available on the Android market for free. Check it out, and if you don’t like it, you can always uninstall it. Let me know what you think. To easily get to the download page in the Android market, simply scan the following QR code: