public class

CMWeatherManager

extends Object
java.lang.Object
   ↳ cyanogenmod.weather.CMWeatherManager

Class Overview

Provides access to the weather services in the device.

Summary

Nested Classes
interface CMWeatherManager.LookupCityRequestListener Interface used to receive notifications upon completion of a request to lookup a city name  
class CMWeatherManager.RequestStatus The different request statuses  
interface CMWeatherManager.WeatherServiceProviderChangeListener Interface used to be notified when the user changes the weather service provider  
interface CMWeatherManager.WeatherUpdateRequestListener Interface used to receive notifications upon completion of a weather update request  
Public Methods
void cancelRequest(int requestId)
Cancels a request that was previously submitted to the weather service.
String getActiveWeatherServiceProviderLabel()
Gets the service's label as declared by the active weather service provider in its manifest
static CMWeatherManager getInstance(Context context)
Gets or creates an instance of the CMWeatherManager
int lookupCity(String city, CMWeatherManager.LookupCityRequestListener listener)
Request the active weather provider service to lookup the supplied city name.
void registerWeatherServiceProviderChangeListener(CMWeatherManager.WeatherServiceProviderChangeListener listener)
Registers a CMWeatherManager.WeatherServiceProviderChangeListener to be notified when a new weather service provider becomes active.
int requestWeatherUpdate(WeatherLocation weatherLocation, CMWeatherManager.WeatherUpdateRequestListener listener)
Forces the weather service to request the latest weather information for the provided WeatherLocation.
int requestWeatherUpdate(Location location, CMWeatherManager.WeatherUpdateRequestListener listener)
Forces the weather service to request the latest available weather information for the supplied Location location.
void unregisterWeatherServiceProviderChangeListener(CMWeatherManager.WeatherServiceProviderChangeListener listener)
Unregisters a listener
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void cancelRequest (int requestId)

Added in API level 5

Cancels a request that was previously submitted to the weather service.

Parameters
requestId The ID that you received when the request was submitted

public String getActiveWeatherServiceProviderLabel ()

Added in API level 5

Gets the service's label as declared by the active weather service provider in its manifest

Returns
  • the service's label

public static CMWeatherManager getInstance (Context context)

Added in API level 5

Gets or creates an instance of the CMWeatherManager

public int lookupCity (String city, CMWeatherManager.LookupCityRequestListener listener)

Added in API level 5

Request the active weather provider service to lookup the supplied city name.

Parameters
city The city name
listener CMWeatherManager.LookupCityRequestListener To be notified once the request has been completed. Upon success, a list of WeatherLocation will be provided
Returns
  • An integer that identifies the request submitted to the weather service. Note that this method might return -1 if an error occurred while trying to submit the request.

public void registerWeatherServiceProviderChangeListener (CMWeatherManager.WeatherServiceProviderChangeListener listener)

Added in API level 5

Registers a CMWeatherManager.WeatherServiceProviderChangeListener to be notified when a new weather service provider becomes active.

public int requestWeatherUpdate (WeatherLocation weatherLocation, CMWeatherManager.WeatherUpdateRequestListener listener)

Added in API level 5

Forces the weather service to request the latest weather information for the provided WeatherLocation. This is the preferred method for requesting a weather update.

Parameters
weatherLocation A WeatherLocation that was previously obtained by calling lookupCity(String, LookupCityRequestListener)
listener CMWeatherManager.WeatherUpdateRequestListener To be notified once the active weather service provider has finished processing your request
Returns
  • An integer that identifies the request submitted to the weather service. Note that this method might return -1 if an error occurred while trying to submit the request.

public int requestWeatherUpdate (Location location, CMWeatherManager.WeatherUpdateRequestListener listener)

Added in API level 5

Forces the weather service to request the latest available weather information for the supplied Location location.

Parameters
location The location you want to get the latest weather data from.
listener CMWeatherManager.WeatherUpdateRequestListener To be notified once the active weather service provider has finished processing your request
Returns
  • An integer that identifies the request submitted to the weather service Note that this method might return -1 if an error occurred while trying to submit the request.

public void unregisterWeatherServiceProviderChangeListener (CMWeatherManager.WeatherServiceProviderChangeListener listener)

Added in API level 5

Unregisters a listener

Parameters
listener A previously registered CMWeatherManager.WeatherServiceProviderChangeListener