Building Accurate Prayer Time Notifications in Mobile Applications

author
By

Jan 17, 2026

Alhamdulillah, we have had the opportunity to work on many Islamic mobile applications, both locally and internationally. While these applications vary in features and audiences, they share a common foundation: prayer schedules, adhan notifications, dhikr collections, and Al-Qur’an content.

Among all these features, one stands out as the most critical and technically challenging — prayer time scheduling and notifications. From our experience, this feature alone often determines user trust and satisfaction. Even a small inaccuracy can lead to significant user complaints.

This article shares our real-world experience building a reliable, accurate, and scalable prayer time notification system in Flutter, along with the challenges we faced and the solution that ultimately worked best.

The Initial Approach: Relying on External APIs

Like many developers, we initially adopted publicly available prayer time APIs such as Adhan-based services. From an implementation standpoint, this approach was straightforward and fast. However, once the application scaled, several limitations surfaced.

Key Challenges We Encountered

1. API Rate Limiting

Our applications serve around 30,000 daily active users. With all users querying the same API using a shared API key, rate limits quickly became a bottleneck. As a result, some users failed to retrieve prayer schedules entirely — an unacceptable outcome for a core feature.

2. Caching Complexity and Accuracy Issues

To mitigate rate limiting, we introduced backend-level caching and proxy mechanisms. Unfortunately, this introduced a new set of problems:

  • Each user resides in a different geographical location
  • Prayer times differ even within the same city, especially for users living near regional borders
  • Storing prayer schedules per user caused cache data to grow uncontrollably

If we normalized schedules by city, accuracy suffered. If we personalized schedules, cache storage became inefficient and difficult to manage.

3. Unreliable Background Fetch for Notifications

Prayer notifications depend heavily on background execution. On mobile platforms:

  • Background fetch intervals are limited and unpredictable
  • Battery optimization modes frequently block background tasks
  • Notification timing becomes inconsistent

As a result, adhan notifications were sometimes delayed — or worse, not triggered at all.

4. User Mobility and Dynamic Schedules

Modern users are highly mobile. A single user may change locations multiple times a day, which directly affects prayer times. This demanded a dynamic and intelligent caching strategy, further increasing system complexity.

The Impact: A Critical Feature Under Scrutiny

Due to these compounded issues, prayer scheduling became the most criticized feature by both clients and end users. This pushed us to rethink our architecture and search for a fundamentally better approach.

A More Optimal Solution: On-Device Astronomical Calculation

After extensive research, we adopted what we consider a far more robust and elegant solution:
performing prayer time calculations directly on the device using astronomical (hisab falakiyah) principles.

Why This Approach Works Better

  • Eliminates dependency on external APIs
  • Removes rate limiting concerns entirely
  • Ensures accurate prayer times based on precise coordinates
  • Works reliably offline once location data is available

We carefully studied multiple calculation methods and jurisprudential differences (madzhab), then implemented the formulas step by step to ensure correctness and flexibility.

This approach proved to be significantly more efficient, accurate, and scalable than fetching prayer times from an API.

Handling Notifications on iOS and Android

Prayer time calculation alone is not enough — notification scheduling is equally critical.

One notable constraint is on iOS, where the system allows a maximum of 64 scheduled local notifications at any given time. To handle this limitation gracefully, we implemented a strategy where:

  • Notifications are scheduled in batches every three days
  • The schedule is recalculated periodically
  • Updates occur whenever the user’s location changes significantly

This ensures notifications remain accurate while staying within platform constraints.

Final Results and Key Takeaways

By moving prayer time calculation directly into the Flutter application, we achieved:

  • ✅ Higher accuracy, even in border regions
  • ✅ Stable notifications regardless of background fetch limitations
  • ✅ Reduced backend load and infrastructure complexity
  • ✅ Improved user trust and satisfaction

Most importantly, this approach aligns better with the expectations of an Islamic application, where precision and reliability are non-negotiable.

Closing Thoughts

Prayer time scheduling is often underestimated in complexity. In reality, it combines astronomy, jurisprudence, mobile OS constraints, and user behavior into a single feature. Our experience shows that investing time in the right architecture pays off significantly in the long run.

For teams building Islamic applications — especially at scale — we strongly recommend considering on-device prayer time calculation as a first-class solution rather than a fallback.

Originally published on Medium

Popular Tags :

Share this post :