Example: Creating a weather forecast MIDlet with in-app advertising support

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. The user 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

Prerequisites

You need the following to develop and test this MIDlet:

  • Nokia SDK 1.0 for Java or newer

    Note: The Series 40 full touch version of the MIDlet requires Nokia SDK 2.0 for Java or newer.

  • Series 40 3rd Edition or S60 3rd Edition device or newer

  • World Weather Online API key

For instructions on how to set up the Java ME development environment, see section Setting up the development environment.

Development

For more information about the MIDlet, see:

  • Design for information about the design and functionality of the MIDlet

  • Implementation for information about implementing the MIDlet

You can download the project files for the MIDlet from the download page.