Getting started

If you come here, you are a developer that wants to extend the library and add some new features.
The first step of course is downloading the source code and you can do it following github guide. Once you have the code you can extend the library in several areas:

  • Add new features
  • Add new weather provider
  • Add new transport layer
  • Custom icons
  • Custom UI components

Add new feature

Even if Android Weatherlib supports several features and several weather providers, there is of course space for adding new features. By now the main features are supported like Current Weather, Forecast, Historical Data, and of course if you want to add new features you can improve the library. Keep in mind that you should provide all weather provider implementation, or if one or more provider doesn't support this feature you should throw UnsupportedException.

Add new weather provider

If you want to add a new weather provider the first thing you have to do is implementing IWeatherProvider. In this class, you have to implement specific protocol details and parse the response extracting the data from the response itself. In this class, you don't have to worry about network implementation because it is already implemented in the transport layer. Other that the specific class that parses the response you have to implement other two classes:
  • One that implements IProviderType
  • One that implements IWeatherCodeProvider

The first class, that implements IProviderType that is used to return the FQN of the classes that have to be instantiated. For example in the case of Openweathermap the class is:

public class YahooProviderType implements IProviderType {
    @Override
    public String getProviderClass() {
        return "com.survivingwithandroid.weather.lib.provider.yahooweather.YahooWeatherProvider";
    }

    @Override
    public String getCodeProviderClass() {
        return "com.survivingwithandroid.weather.lib.provider.yahooweather.YahooWeatherCodeProvider";
    }
}