tilfluktsrom/CLAUDE.md
Ole-Morten Duesund 27cad094e7 Initial commit: Norwegian emergency shelter finder app
Android app (Kotlin) that locates the nearest public shelter (tilfluktsrom)
in Norway. Designed for offline-first emergency use.

Features:
- Downloads and caches all 556 Norwegian shelter locations from Geonorge
- GPS-based nearest shelter finding with distance and bearing
- OSMDroid map with offline tile caching for surroundings
- Large directional compass arrow pointing to selected shelter
- Compass sensor integration for real-time direction updates
- Shows 3 nearest shelters with distance, capacity, and address
- Toggle between map view and compass/arrow view
- Auto-caches map tiles on first launch for offline use
- Weekly background data refresh with manual force-update
- i18n: Norwegian Bokmål, Nynorsk, and English

Technical:
- EPSG:25833 (UTM33N) → WGS84 coordinate conversion
- Haversine distance and bearing calculations
- Room database for shelter persistence
- Fused Location Provider for precise GPS
- Sensor fusion (rotation vector with accel+mag fallback) for compass

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-08 16:14:19 +01:00

1.7 KiB

Tilfluktsrom - Norwegian Emergency Shelter Finder

Project Overview

Android app (Kotlin) that helps find the nearest public shelter (tilfluktsrom) in Norway during emergencies. Offline-first design: must work without internet after initial data cache.

Architecture

  • Language: Kotlin, targeting Android API 26+ (Android 8.0+)
  • Build: Gradle 8.7, AGP 8.5.2, KSP for Room annotation processing
  • Maps: OSMDroid (offline-capable OpenStreetMap)
  • Database: Room (SQLite) for shelter data cache
  • HTTP: OkHttp for data downloads
  • Location: Google Play Services Fused Location Provider
  • UI: Traditional Views with ViewBinding

Key Data Flow

  1. Shelter data downloaded as GeoJSON ZIP from Geonorge (EPSG:25833 UTM33N)
  2. Coordinates converted to WGS84 (lat/lon) via CoordinateConverter
  3. Stored in Room database for offline access
  4. Nearest shelters found using Haversine distance calculation
  5. Direction arrow uses device compass bearing minus shelter bearing

Data Sources

  • Shelter data: https://nedlasting.geonorge.no/geonorge/Samfunnssikkerhet/TilfluktsromOffentlige/GeoJSON/...
  • Map tiles: OpenStreetMap via OSMDroid (auto-cached for offline use)

Package Structure

no.naiv.tilfluktsrom/
├── data/          # Room entities, DAO, repository, GeoJSON parser, map cache
├── location/      # GPS location provider, nearest shelter finder
├── ui/            # Custom views (DirectionArrowView), adapters
└── util/          # Coordinate conversion (UTM→WGS84), distance calculations

Building

./gradlew assembleDebug

i18n

  • Default (English): res/values/strings.xml
  • Norwegian Bokmål: res/values-nb/strings.xml
  • Norwegian Nynorsk: res/values-nn/strings.xml