public class

LineageWeatherManager

extends Object
java.lang.Object
   ↳ lineageos.weather.LineageWeatherManager

Class Overview

Provides access to the weather services in the device.

Summary

Nested Classes
interface LineageWeatherManager.LookupCityRequestListener Interface used to receive notifications upon completion of a request to lookup a city name  
class LineageWeatherManager.RequestStatus The different request statuses  
interface LineageWeatherManager.WeatherServiceProviderChangeListener Interface used to be notified when the user changes the weather service provider  
interface LineageWeatherManager.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 LineageWeatherManager getInstance(Context context)
Gets or creates an instance of the LineageWeatherManager
int lookupCity(String city, LineageWeatherManager.LookupCityRequestListener listener)
Request the active weather provider service to lookup the supplied city name.
void registerWeatherServiceProviderChangeListener(LineageWeatherManager.WeatherServiceProviderChangeListener listener)
Registers a LineageWeatherManager.WeatherServiceProviderChangeListener to be notified when a new weather service provider becomes active.
int requestWeatherUpdate(Location location, LineageWeatherManager.WeatherUpdateRequestListener listener)
Forces the weather service to request the latest available weather information for the supplied Location location.
int requestWeatherUpdate(WeatherLocation weatherLocation, LineageWeatherManager.WeatherUpdateRequestListener listener)
Forces the weather service to request the latest weather information for the provided WeatherLocation.
void unregisterWeatherServiceProviderChangeListener(LineageWeatherManager.WeatherServiceProviderChangeListener listener)
Unregisters a listener
[Expand]
Inherited Methods
From class java.lang.Object

Public Methods

public void cancelRequest (int requestId)

added in API level 8

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

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

public String getActiveWeatherServiceProviderLabel ()

added in API level 8

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

Returns
String the service's label

public static LineageWeatherManager getInstance (Context context)

added in API level 8

Gets or creates an instance of the LineageWeatherManager

Returns
LineageWeatherManager LineageWeatherManager

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

added in API level 8

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

Parameters
city String: The city name
listener LineageWeatherManager.LookupCityRequestListener: LineageWeatherManager.LookupCityRequestListener To be notified once the request has been completed. Upon success, a list of WeatherLocation will be provided
Returns
int 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 (LineageWeatherManager.WeatherServiceProviderChangeListener listener)

added in API level 8

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

Parameters
listener LineageWeatherManager.WeatherServiceProviderChangeListener: LineageWeatherManager.WeatherServiceProviderChangeListener to register

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

added in API level 8

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

Parameters
location Location: The location you want to get the latest weather data from.
listener LineageWeatherManager.WeatherUpdateRequestListener: LineageWeatherManager.WeatherUpdateRequestListener To be notified once the active weather service provider has finished processing your request
Returns
int 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 (WeatherLocation weatherLocation, LineageWeatherManager.WeatherUpdateRequestListener listener)

added in API level 8

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 WeatherLocation: A WeatherLocation that was previously obtained by calling lookupCity(String, LookupCityRequestListener)
listener LineageWeatherManager.WeatherUpdateRequestListener: LineageWeatherManager.WeatherUpdateRequestListener To be notified once the active weather service provider has finished processing your request
Returns
int 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 (LineageWeatherManager.WeatherServiceProviderChangeListener listener)

added in API level 8

Unregisters a listener

Parameters
listener LineageWeatherManager.WeatherServiceProviderChangeListener: A previously registered LineageWeatherManager.WeatherServiceProviderChangeListener