DEV Community

Cover image for Building Hijri Today: A Widget My Mom Actually Uses
Cahyanudien Aziz Saputra
Cahyanudien Aziz Saputra

Posted on

Building Hijri Today: A Widget My Mom Actually Uses

The Problem

Two days ago, my mom told me she keeps forgetting the Hijri (Islamic) date. She likes doing Sunnah fasting on specific days—the white days (13th, 14th, 15th of each lunar month), Mondays, Thursdays, and special occasions. She has a physical Islamic calendar, but realistically, who checks wall calendars daily anymore?

The solution seemed obvious: put it where she already looks dozens of times a day—her phone's home screen.

The Solution: Hijri Today Widget

I built a simple Android widget that displays the current Hijri date. The app adapts to your language preference—it's called Hijri Today in English, Hijri Hari Ini in Indonesian, and التاريخ الهجري اليوم in Arabic. That's it. No bloat, no complexity, just the information you need.

Features

Core:

  • 📅 Displays current Hijri date
  • 🔄 Auto-updates twice daily (6 PM & midnight)
  • 🌍 Multilingual (English, Indonesian, Arabic)
  • 📱 Works as a widget—no need to open the app

Helpful Extras:

  • 🌙 Sunnah fasting reminders (Ayyamul Bidh, Monday/Thursday, Ashura, Arafah)
  • 🕌 Islamic event notifications (Ramadan, Eids, Islamic New Year, Mawlid)
  • 🚫 No ads, no tracking, no premium features
  • ⚡ Lightweight and battery-efficient

Tech Stack

- Language: Kotlin
- UI Framework: Jetpack Compose
- Widget API: Glance
- Design: Material Design 3
- License: MIT (Open Source)
Enter fullscreen mode Exit fullscreen mode

Technical Challenges & Solutions

Challenge 1: Reliable Widget Updates

Problem: Widgets need to update without draining battery or getting killed by the system.

Solution: Strategic update timing at 6 PM (default sunset time) and midnight using Android's exact alarm permissions. This ensures updates happen when they matter most while being battery-efficient.

// Simplified update scheduling
val alarmManager = context.getSystemService(AlarmManager::class.java)
val updateTimes = listOf(
    LocalTime.of(18, 0), // 6 PM
    LocalTime.of(0, 0)   // Midnight
)
Enter fullscreen mode Exit fullscreen mode

Challenge 2: Language Changes Affecting Widget

Problem: Changing language in the app needs to update the widget immediately, not wait for the next scheduled update.

Solution: Used a broadcast receiver to listen for language preference changes and trigger immediate widget refresh.

// Language change broadcasts to widget
val intent = Intent(context, HijriWidgetReceiver::class.java).apply {
    action = ACTION_UPDATE_WIDGET
}
context.sendBroadcast(intent)
Enter fullscreen mode Exit fullscreen mode

Challenge 3: Hijri Date Calculation

Problem: Need accurate Hijri date conversion without external API calls (for offline functionality).

Solution: Implemented local Hijri calendar calculation using java.time APIs and established conversion algorithms. This keeps the app working offline and fast.

Design Philosophy: Intentional Simplicity

I deliberately kept this app minimal. Here's what I didn't include:

  • ❌ Prayer times (there are better apps for that)
  • ❌ Qibla direction
  • ❌ Full calendar view
  • ❌ Monetization (ads, in-app purchases, premium features)
  • ❌ Analytics or tracking

Why? Because each feature adds complexity, maintenance burden, and dilutes the core purpose. This app does one thing really well: showing you the Hijri date.

Privacy-First Approach

✅ No data collection
✅ No analytics
✅ No third-party services
✅ All processing done locally
✅ Open source (MIT License)
Enter fullscreen mode Exit fullscreen mode

In an era where every app wants your data, building something that genuinely respects privacy felt important—especially for an app meant to support religious practice.

The User Experience

The goal was maximum utility with minimum friction:

  1. Install the app
  2. Add widget to home screen (one time)
  3. Forget about it — it just works

No daily app opening required. No notifications unless there's an actual Islamic event. No "rate us" popups. Just a quiet, helpful tool.

Code Architecture

app/
├── ui/
│   ├── compose/      # Jetpack Compose screens
│   └── widget/       # Glance widget implementation
├── data/
│   ├── HijriCalculator.kt    # Date conversion logic
│   ├── IslamicEvents.kt      # Event definitions
│   └── Preferences.kt        # User settings
├── workers/
│   └── WidgetUpdateWorker.kt # Background updates
└── receivers/
    └── HijriWidgetReceiver.kt # Widget broadcast handling
Enter fullscreen mode Exit fullscreen mode

Lessons Learned

1. Solve Real Problems

My mom's problem wasn't unique. Thousands of Muslims worldwide probably face the same issue. Building for one real user beats building for an imaginary market.

2. Constraints Breed Creativity

Limiting myself to "just a widget" forced creative solutions for notifications, language changes, and event reminders without bloating the app.

3. Open Source Creates Trust

For an app dealing with religious practice, transparency matters. Users can verify there's no tracking, no data collection, no hidden features.

4. Battery Efficiency Is Still Hard

Even with modern Android APIs, creating reliable widgets without battery drain requires careful thought about update frequency and alarm management.

What's Next?

I'm keeping this intentionally minimal, but I'm open to:

  • Bug fixes and performance improvements
  • Additional language support if requested
  • Accessibility enhancements
  • Community contributions via GitHub

What I won't add:

  • Features that bloat the app
  • Monetization
  • Data collection

Try It

Download: Google Play Store

Website: flagodna-developer.github.io/project/hijri-today

Final Thoughts

Not every app needs to be a startup. Not every project needs to "scale" or "disrupt."

Sometimes, it's enough to build something simple that solves a real problem for real people—even if that person is your mom.


Tech Stack Summary:

Platform: Android
Language: Kotlin
UI: Jetpack Compose
Widget: Glance API
Design: Material Design 3
Size: ~3MB
Min SDK: Android 8.0
License: MIT
Price: Free (no ads, no IAP)
Enter fullscreen mode Exit fullscreen mode

Barakallahu fiikum! 🤲

Have questions about the implementation? Drop them in the comments—I'm happy to discuss the technical details!


Tags

#android #kotlin #jetpackcompose #opensource #muslim #widget #minimalism #privacy

Top comments (0)