Skip to main content

February 22nd, 2026

The Native Scheduler & Global UI Optimization Today was a massive architectural shift deep within the Android Native layer, focusing on reliable scheduling, device boot recovery, and optimizing the React Native UI layer.

Native Scheduler Architecture

We completely revamped how alarms are scheduled and triggered natively:
  • Simplified Alarm Logic: Nuked the complex legacy scheduling in favor of a clean baseline. We implemented AlarmScheduler to query the local Expo SQLite DB directly for the next upcoming valid task instance.
  • Android AlarmManager API: Integrated AlarmManager (Exact/Clock) to schedule native OS triggers that persist through app swipes and deep doze states.
  • Alarm Receiver & Activity: Created AlarmReceiver and AlarmActivity to handle the wake-up intent and display a basic lock-screen UI.
  • Alarm Chaining & Media: Wired the DISMISS button in AlarmActivity to instantly schedule the next chronological alarm. The Activity now plays the system’s default alarm ringtone and vibrates continuously. We also directly update the local SQLite DB (markInstanceProceeded) when an alarm is dismissed.
  • Boot Recovery: Implemented BootReceiver recovery to automatically call AlarmScheduler.scheduleNextAlarm() on device restart, ensuring alarms survive reboots.
  • Lock-Screen Bypassing: Switched to a dedicated native AndroidManifest.xml within the module (removing the legacy withAlarmPermissions config plugin). We added turnScreenOn, showWhenLocked, and keepScreenOn to AlarmActivity to ensure the screen wakes up and bypasses the keyguard on Android 10+. BootReceiver, AlarmReceiver, and AlarmActivity were marked with directBootAware="true".

Pre-Alarms & Telemetry

  • Engineered a deeply integrated native Pre-Alarm system mapping staggered event triggers (-15m, -13m… -1m).
  • Added extensive trace block logging across all Kotlin files for lifecycle observability.
  • Rewrote Android OS Window Manager configuration logic in AlarmActivity to differentiate dynamic ‘Pre-Alarm’ countdown typography vs ‘Main-Alarm’ execution displays.
  • Comprehensively refactored all Kotlin files to use professional telemetry markers and extensive KDoc architectural comments.

Global UI Optimization

We also achieved sub-millisecond tap-to-render latency on calendar events:
  • Root Migration: Moved EventDetailModal from individual tab screens up to the root tab navigator _layout.tsx.
  • View Hierarchy Optimization: Prevented React Navigation from mounting multiple identical modal components simultaneously across active tabs, mitigating Android view hierarchy conflicts.
  • Render Cycle Decoupling: Unsubscribed schedules.tsx from reading the modal’s Zustand state. It now uniquely imports the setter, allowing instantaneous modal triggering without forcing a re-render of the heavy calendar instance.
  • Added extensive JSDoc architectural comments and structural diagrams detailing the Singleton architecture in the Root Layout and the native map interface in location-set.tsx.