Skip to content

About

Android weather app for any location — search any city or use GPS. Kotlin + Compose, Open-Meteo, no API key. Ported from a Samsung Tizen TV app.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Weather

An Android weather app for any location — current conditions, the next 24 hours, and a 7-day forecast. Search for a city or use the device's GPS.

Ported from Copenhagen Weather, a Samsung Tizen TV app that showed one hardcoded city. This version keeps that app's palette, its weather icons and its day-selection model, and adds the two things a phone needs: arbitrary locations and GPS.

Website

All three pages carry a live forecast panel with a working location search — the same Open-Meteo data the app uses, so you can try the idea before installing anything.

Download

Android 8.0 (API 26) or newer.

Features

  • Any location. Type-ahead search over Open-Meteo's geocoder. Country and region are shown, so the dozen places that share a name stay tellable apart.
  • Device GPS. One tap resolves your coordinates and reverse-geocodes them to a place name, falling back to coordinates where no geocoder backend exists.
  • Saved locations. Switch between them; the list persists. The GPS entry updates in place instead of stacking a new row per fix.
  • The right local time. Each location shows its own wall clock and its own day/night icons, taken from the API's UTC offset — Tokyo reads as Tokyo even from Denmark.
  • Seven days, selectable. Tap a day and the headline, the six stat tiles and the hourly strip all retarget to it.
  • Home screen widget. Current conditions for the selected location, in the app's own artwork. Follows whatever place is selected in the app, refreshes every half hour, and taps through to the full forecast.
  • Metric or imperial. Converted on the client, so switching needs no refetch.
  • Works offline. The last successful response is cached per location and shown with a stale marker when the network is unavailable.
  • Nothing to sign up for. No API key, no account, no analytics, no ads.

Privacy

Weather has no account, no analytics, no ads and no server of its own. What leaves the phone, as the code stands:

  • Forecasts. For the selected place (searched, saved or your device location), in the app and in the home screen widget, the latitude and longitude, to four decimals, go in a plain HTTPS GET request to api.open-meteo.com.
  • Search. What you type in the search box (two characters or more) and the phone's language code go to geocoding-api.open-meteo.com.
  • Naming your location. Location permission is optional and coarse only; search works without it. With it, the app asks Android's location manager for a fix, then passes the fix's latitude and longitude to Android's built-in Geocoder to get a place name. That service is provided by the device, not by the app. The code notes that it needs a backend service some devices and ROMs lack, and the app cannot say whether or where that service sends the coordinates. If it is missing or fails, the app uses the coordinates as the name.

Saved places, the selected place, the unit and theme preferences and the last forecast per place are stored in the app's private storage on the device. The manifest allows Android's own device backup (allowBackup), so if backup is on for the phone, that data may be included in it.

Build

Requires JDK 17 and the Android SDK (platform 37, build-tools 36).

git clone https://github.com/cocodedk/weather-android.git
cd weather-android

export JAVA_HOME=/path/to/jdk-17
export ANDROID_HOME=/path/to/android-sdk
echo "sdk.dir=$ANDROID_HOME" > local.properties

./gradlew assembleDebug
adb install -r app/build/outputs/apk/debug/app-debug.apk
./gradlew buildSmoke   # build + unit tests + lint — what CI runs

Contributing

Run ./scripts/install-hooks.sh after cloning. Setup, branch naming, coding conventions and the PR checklist are in CONTRIBUTING.md. Security reports go through SECURITY.md.

Architecture

app/src/main/java/dk/cocode/weather/
├── domain/     pure Kotlin — WMO codes, units, wall-clock parsing (no Android imports)
├── data/       Open-Meteo clients, device location, DataStore, per-place cache
├── ui/         Compose screen, ViewModel, and the icon set drawn to a Canvas
└── widget/     home screen widget (RemoteViews), reusing the app's icon geometry
website/        GitHub Pages site — plain HTML/CSS/JS, no build step
tools/          selftest.html — exercises the site's JS against the live API
Concern Choice Why
UI Jetpack Compose + Material 3 Declarative, and the app is one screen with a sheet
Networking HttpURLConnection Ships with Android; the app makes plain GET requests
JSON org.json Ships with Android; no reflection, no codegen
Location LocationManager No Play Services dependency, so it runs on any device
Storage DataStore Preferences Saved places, unit preference, cached responses

Two design rules govern most of the code:

Wall-clock times are parsed as digits, not instants. Open-Meteo returns times already localised to the requested place. Parsing them through Instant/Date would re-interpret them in the phone's timezone and quietly shift every forecast for any city you don't live in.

Missing data renders as --, never as a number. org.json returns NaN and 0 where the API means "no value", so data/Json.kt collapses those to null before a formatter can turn them into a plausible-looking reading.

Data

Forecasts and geocoding from Open-Meteo, used under their free non-commercial terms. No API key is required.

Author

Babak Bandpey — cocode.dk | LinkedIn | GitHub

License

Apache-2.0 | © 2026 Cocode | Created by Babak Bandpey

About

Android weather app for any location — search any city or use GPS. Kotlin + Compose, Open-Meteo, no API key. Ported from a Samsung Tizen TV app.

Resources

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages