Chapter 11. Creating a Weather Client
WHAT'S IN THIS CHAPTER?
Using Google Weather and Map APIs
Parsing JSON using ActionScript
Using the S60 Location Service API
Using PureMVC to build a Weather Client
There are numerous location-based service APIs that mobile developers can utilize in their applications that are open to you as a developer for consumption.
In this chapter you'll learn how to use a weather-based Web service in your applications that utilizes the location retrieved from the device.
GOOGLE APIS
In this chapter you're going to examine a Flash Lite Weather Client, combining the S60 Symbian Location Services API covered in the last chapter, and two Google APIs:
Google Weather API
Google Map API
Using Google Weather API
Using the Google Weather API will allow us to retrieve the following information for use in the Flash Lite application:
Current weather conditions for a given location
Predicted weather forecasts for the next four days
The Google Weather API is not extensively documented; nevertheless, retrieving the data you need from service is straightforward.
Here's an example HTTP request to retrieve weather information for Kuala Lumpur in Malaysia:
http://www.google.com/ig/api?weather=Kuala Lumpur, Malaysia&hl=en
In this request you can see that it takes two query parameters in the form of a location weather=Kuala Lumpur, Malaysia
and also a language hl=en
.
Defining Location
There are several variations of the location you can assign to weather
, including the following:
City, Country ...
Get Professional Flash® Lite® Mobile Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.