This example shows you how to create a simple location-aware weather forecast MIDlet that also supports in-app advertising. The MIDlet shows a four-day forecast with temperatures, relative humidity, wind speed, and wind direction. The MIDlet retrieves the weather forecast information based on the device's current location, which the MIDlet determines using either cell ID or GPS positioning. You can also explicitly specify the location for which to retrieve the weather forecast information. The MIDlet uses World Weather Online APIs for retrieving both weather data and location search data, and the org.json.me library for parsing the JavaScript Object Notation (JSON) values returned by the World Weather Online APIs. In addition, the MIDlet employs in-app advertising in the form of banners and full-screen ads.
In short, this example demonstrates how to:
Use the Location API for cell ID and GPS positioning
Use World Weather Online APIs for retrieving weather and location search data
Parse JSON values
Implement in-app advertising
The MIDlet has been designed to work especially on various Series 40 devices with different form factors and input methods.
Figure: WeatherApp MIDlet
You need the following to develop and test this MIDlet:
Nokia Asha SDK 1.0
Nokia Asha software platform 1.0 or Series 40 phone with CLDC 1.1, MIDP 2.1 APIs
Inneractive API key for in-app advertising plugin
You need to acquire your own API keys for using the World Weather Online API (http://www.worldweatheronline.com) and Inneractive API (http://www.inner-active.com). Replace the placeholder keys in com.nokia.example.weatherapp.network.Keys class with the acquired keys. Otherwise, the MIDlet throws a NullPointerException when it is closed.
For more information about the MIDlet, see the following subsections on this page:
Design for details about the design and functionality of the MIDlet
Implementation for instructions on how to implement the classes that make the MIDlet
You can download the project files for the MIDlet from the download page.