Skip to content

Oleg52/HTC-Weather-App-Mod

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 

Repository files navigation

HTC Weather App — Open-Meteo Free API Mod

Modification of the HTC Sense Weather app(version 10.00.1113635) to replace the proprietary AccuWeather API (which requires a paid API key) with Open-Meteo — a completely free, open-source weather API that requires no API key and has no usage limits.

Why

HTC discontinued their AccuWeather API key, breaking the built-in weather app on all HTC devices. This mod restores full weather functionality using free APIs, with no expiration date.

Installation

Version 10.00.1113635 works on Android 6+.

Since app requires htc signature to function properly, original signature was copied to modified apk. It means that app cannot be installed without root access.

For example, you can use Magisk module to disable app signature verification.

In my case(HTC M9 Plus, Android 6) installation steps are:

  1. Download Weather.apk.
  2. Delete existing weather app folder(in /system/app or /system/priv-app).
  3. Copy Weather.apk to the /system/app or /system/priv-app and set 0644 permission.
  4. Reboot and clean data of weather and weather clock widget apps.
  5. Done

What Was Changed

Smali modifications were permormed by Claude AI.

New File

  • OpenMeteoAdapter.smali — Adapter class that fetches weather data from Open-Meteo and returns AccuWeather-compatible JSON, so all original UI parsing code works unchanged.

Modified Files

  • b.smali (AccuWeatherJsonParser) — Redirects weather data fetching through the adapter; resolves legacy city codes to lat/lon coordinates via the built-in city database
  • b$a.smali (Location Cache) — Replaces AccuWeather geoposition lookup with Open-Meteo timezone API + nearest-city lookup from built-in database
  • AccuWeatherOnlineSearchHelper.smali — Replaces AccuWeather city search with Open-Meteo Geocoding API
  • a.smali (AccuWeatherAddressProvider) — GPS location resolution now uses the adapter
  • b.smali (AddressProviderManager) — Chain logging for location resolution

APIs Used (All Free, No Keys Required)

API Purpose URL
Open-Meteo Forecast Current conditions, hourly & daily forecasts api.open-meteo.com/v1/forecast
Open-Meteo Geocoding City name search geocoding-api.open-meteo.com/v1/search

Features

  • Current weather conditions — temperature (C/F), humidity, wind speed/direction, visibility, weather icon, feels-like temperature
  • 10-day daily forecast — high/low temps, sunrise/sunset, precipitation probability, day/night weather icons
  • 12-hour hourly forecast — temperature, weather icon, precipitation probability
  • City search — search by name in any language via Open-Meteo Geocoding
  • Built-in city database — 3,641 pre-loaded cities with localized names work via lat/lon lookup from the existing wpdb.zip database
  • GPS current location — detects nearest city from built-in database + timezone from Open-Meteo
  • Weather.com links — clicking weather entries opens the corresponding Weather.com page:
    • Current: weather.com/weather/today/l/{lat},{lon}
    • Hourly: weather.com/weather/hourbyhour/l/{lat},{lon}
    • Daily: weather.com/weather/tenday/l/{lat},{lon}

Technical Details

Adapter Architecture

The key design decision was creating an adapter layer (OpenMeteoAdapter.smali) that translates Open-Meteo API responses into AccuWeather-compatible JSON format. This means:

  • All original JSON parsing code in AccuWeatherJsonParser remains completely untouched
  • Only the URL construction and HTTP fetch steps were swapped out
  • The adapter handles all format translation: WMO weather codes → AccuWeather icon numbers, Celsius ↔ Fahrenheit conversion, timezone offset formatting, etc.

WMO Weather Code Mapping

Open-Meteo uses WMO standard weather codes (0-99) while AccuWeather uses proprietary icon numbers (1-44). The adapter maps between them with day/night variants:

WMO Condition AccuWeather (Day/Night)
0 Clear sky 1 / 33
1 Mainly clear 2 / 34
2 Partly cloudy 3 / 35
3 Overcast 7
45, 48 Fog 11
51-55 Drizzle 12, 18 / 39
61-65 Rain 12, 18 / 39
71-77 Snow 22
80-82 Rain showers 12, 18 / 39
95-99 Thunderstorm 15 / 42

Location System

The original app used AccuWeather's proprietary location IDs (e.g., 328328 for London). The mod replaces this with a "lat,lon" string format (e.g., "51.508,-0.126"). This flows through the entire system:

  1. City search returns "lat,lon" as the location code
  2. Built-in database cities are resolved from legacy codes (e.g., EUR|UK|UK124|LONDON) to "lat,lon" via the locationlist content provider
  3. GPS detection uses the nearest city from the built-in 3,641-city database
  4. Weather URLs use lat/lon directly — no intermediate location ID needed

SSL Workaround

Older HTC devices have outdated SSL certificates that can't verify Let's Encrypt (used by Open-Meteo). The adapter uses HTTP instead of HTTPS for API calls. This is acceptable because:

  • Weather data is not sensitive
  • The app runs on a local device (not a server)
  • Browser handles HTTPS fine for the Weather.com links

HTTP Implementation

The adapter uses its own HttpURLConnection implementation instead of the app's built-in f.a() utility, which failed for non-AccuWeather domains. Features:

  • 10-second connect/read timeouts
  • Custom User-Agent header
  • Proper error handling with retry logic

Building

Requires APKTool:

java -jar apktool.jar b -c -f "Weather" -o "Weather.apk"

The -c flag preserves the original AndroidManifest.xml.

Credits

  • Open-Meteo — Free weather API (no key required, open source)
  • Weather.com — Weather web pages for click-through links

About

Modification of the HTC Sense Weather app that uses Open Meteo instead of AccuWeather.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages