WIMM Labs


com.wimm.framework.provider
Class Weather

java.lang.Object
  extended by com.wimm.framework.provider.Weather

public final class Weather
extends Object

This class exposes constants and methods for accessing weather forecast data in the WIMM Weather App. These data will be updated everytime the device sync with the WIMM server. Up to 7 days of weather forecast data will be available.

See Android Content Providers Dev Guide for more information on using ContentProvider.

Since:
WIMM SDK 1.0.0

Nested Class Summary
static interface Weather.Columns
          Columns for the Weather table.
static class Weather.WeatherInfo
           This class represents a single day of weather information for a specific city.
 
Field Summary
static String AUTHORITY
          The authority.
static String CONTENT_AUTHORITY
          The content:// style URL for this provider.
static Uri CONTENT_URI
          The content:// style URL for this provider.
static String DEFAULT_SORT_ORDER
          The default sort order for this table.
 
Constructor Summary
Weather()
           
 
Method Summary
static List<String> getCityTokens(ContentResolver cr)
          Return An ArrayList of CITY_UID for all the cities that the user has added in the Weather App web preference settings.
static Weather.WeatherInfo getFirstCityWeatherForToday(ContentResolver cr)
          Convenience method for retrieving weather for the current day for the user's home city.
static Weather.WeatherInfo[] getWeatherForCity(ContentResolver cr, String cityUid)
          Retrieves all available weather data for the city matching cityUid.
static Weather.WeatherInfo getWeatherInfoFromCursor(Cursor c)
          Retrieves a Weather.WeatherInfo object from a Cursor at the current row.
static Cursor query(ContentResolver cr, String[] projection)
          Use this method to query for a Cursor that points to all the Weather data in the Weather App database.
static Cursor query(ContentResolver cr, String[] projection, String where, String[] whereArgs, String orderBy)
          Use this method to query with arguments for a Cursor that points to specific Weather data in the Weather App database.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AUTHORITY

public static final String AUTHORITY
The authority.

Constant Value: "com.wimm.weather"

Since:
WIMM SDK 1.0.0
See Also:
Constant Field Values

CONTENT_AUTHORITY

public static final String CONTENT_AUTHORITY
The content:// style URL for this provider.

Since:
WIMM SDK 1.0.0
See Also:
Constant Field Values

CONTENT_URI

public static final Uri CONTENT_URI
The content:// style URL for this provider.

Since:
WIMM SDK 1.0.0

DEFAULT_SORT_ORDER

public static final String DEFAULT_SORT_ORDER
The default sort order for this table.

Since:
WIMM SDK 1.0.0
See Also:
Constant Field Values
Constructor Detail

Weather

public Weather()
Method Detail

query

public static final Cursor query(ContentResolver cr,
                                 String[] projection)
Use this method to query for a Cursor that points to all the Weather data in the Weather App database.

Here's an example:

Parameters:
cr - The ContentResolver.
projection - The list of columns to put into the cursor. If null all columns are included.
Returns:
The Cursor.
Since:
WIMM SDK 1.0.0

query

public static final Cursor query(ContentResolver cr,
                                 String[] projection,
                                 String where,
                                 String[] whereArgs,
                                 String orderBy)
Use this method to query with arguments for a Cursor that points to specific Weather data in the Weather App database.

Here's an example that query for specifics Weather.Columns of all the Weather data for Los Altos city.

Parameters:
cr - The ContentResolver.
projection - The list of columns to put into the cursor. If null all columns are included.
where - The filter to apply.
whereArgs - The filter arguments.
orderBy - How to sort the cursor rows. If null the provider defines the sort order.
Returns:
The Cursor.
Since:
WIMM SDK 1.0.0

getWeatherInfoFromCursor

public static final Weather.WeatherInfo getWeatherInfoFromCursor(Cursor c)
Retrieves a Weather.WeatherInfo object from a Cursor at the current row.

Returns null if no more rows exist.

See query(android.content.ContentResolver, java.lang.String[]) sample code for usage example.

Parameters:
c - The Cursor.
Returns:
The Weather.WeatherInfo.
Since:
WIMM SDK 1.0.0

getCityTokens

public static final List<String> getCityTokens(ContentResolver cr)
Return An ArrayList of CITY_UID for all the cities that the user has added in the Weather App web preference settings.

Returns null if no cities were found.

Parameters:
cr - The ContentResolver.
Returns:
An array of city tokens.
Since:
WIMM SDK 1.0.0

getWeatherForCity

public static final Weather.WeatherInfo[] getWeatherForCity(ContentResolver cr,
                                                            String cityUid)
Retrieves all available weather data for the city matching cityUid. Up to 7 days of weather data can be retrieved.

Returns null if no data was found.

Parameters:
cr - The ContentResolver.
cityUid - The city UID.
Returns:
An array of Weather.WeatherInfo.
Since:
WIMM SDK 1.0.0

getFirstCityWeatherForToday

public static final Weather.WeatherInfo getFirstCityWeatherForToday(ContentResolver cr)
Convenience method for retrieving weather for the current day for the user's home city.

If the user has configured the Weather application to NOT show a specified home city, then the first city in the Weather application list will be used instead.

Returns null if no data was found.

Parameters:
cr - The ContentResolver.
Returns:
The Weather.WeatherInfo.
Since:
WIMM SDK 1.0.0

WIMM Labs