Native Android Islamic Prayer Engine · Aug, 2026
Aqim As-Salah
An offline-first, high-precision Islamic prayer engine and spiritual companion engineered natively in Kotlin to overcome background OS battery throttling and alarm suppression.

Built with
- Kotlin 2.0
- Jetpack Compose
- Material 3
- Android SDK
- Kotlin Coroutines
- StateFlow
- CameraX
- Jetpack DataStore
- ProGuard/R8
Key features
- Doze-Resilient Alarm Scheduling
- Pure Astronomical Solar Engine
- Fail-Safe Dual-Engine Motion Detection
- Spherical Trigonometry Qibla
- Dynamic Anti-Aliased RemoteViews
- Zero-Telemetry Privacy Contract
Project Overview
Aqim As-Salah («أقم الصلاة») is an offline-first, high-precision Islamic prayer schedule, alert engine, and spiritual companion engineered natively for Android. It was built specifically to solve two pervasive problems in modern mobile operating systems: OEM background task suppression (where battery optimizations delay critical alarms by up to an hour) and privacy degradation in mainstream utilities.
Core Engineering Challenges & Solutions
1. Bypassing Android Doze Batching & RTC Jitter
- The Problem: Modern Android systems (API 26–35+) enforce aggressive power-saving Doze windows that batch alarms into 9-minute intervals, causing prayer calls and wake-up alarms to fail or fire late.
- The Solution: Engineered an idempotent 48-hour pipeline leveraging
AlarmManager.setAlarmClock(), which the Linux kernel and Android AlarmManagerService treat as a user-critical event exempt from batching, delivering sub-second accuracy (+40ms to +1.5s real-device dispatch).
2. Pure Clean Architecture (:domain JVM Module)
- Strictly decoupled all astronomical solar declination equations, shadow-length ratios, and spherical trigonometry calculations into a pure Kotlin JVM library.
- Contains zero Android framework imports (
android.*), allowing the mathematical engine to execute unit tests in milliseconds on local developer machines with 100% test coverage.
3. Zero-Permission Fail-Safe Motion Detection
- Designed a dual-engine wake-up routine for the Fajr alarm:
- Primary: Hardware step detector sensor.
- Secondary (Automatic Fallback): A custom peak-valley algorithm running over unprivileged 3D accelerometer signals with dynamic threshold hysteresis and 280ms debouncing.
4. Memory-Conscious Adaptive Widgets
- Implemented dynamic dimension polling via
AppWidgetManager.getAppWidgetOptions()to calculate pixel bounds on the fly, applying in-memory antialiased clipping masks withPorterDuff.Mode.SRC_INto guarantee sharp, perfectly rounded corners across diverse OEM launchers.
Privacy & Deployment Footprint
- Zero-Telemetry Contract: Strictly 0 KB of network tracking, analytics SDKs, or background telemetry.
- Binary Optimization: Shrunk via R8 full-mode tree shaking into a compact 9.85 MB release binary supporting 10 major Android versions (API 26 to 35+).