# Plugin fix: Android 6.0 (API 23) compatibility — replace java.time.ZoneId with TimeZone **Date:** 2026-02-27 **Target repo:** daily-notification-plugin **Consuming app:** crowd-funder-for-time-pwa (TimeSafari) **Platform:** Android --- ## Summary On Android 6.0 (API 23), the plugin crashes at runtime when scheduling a daily notification because it uses `java.time.ZoneId`, which is only available from **API 26**. Replacing that with `java.util.TimeZone.getDefault().getID()` restores compatibility with API 23 and has **no functional impact** on API 26+ (same timezone ID string, same behavior). --- ## Problem - **File:** `android/src/main/java/com/timesafari/dailynotification/NotifyReceiver.kt` - **Approximate location:** inside `scheduleExactNotification()`, when building `NotificationContentEntity` (around line 260). The code uses: ```kotlin java.time.ZoneId.systemDefault().id ``` On API 23 this causes a runtime failure (e.g. `NoClassDefFoundError`) when the scheduling path runs, because `java.time` was added to Android only in API 26 (Oreo). --- ## Required change Replace the `java.time` call with the API-1–compatible equivalent. **Before:** ```kotlin java.time.ZoneId.systemDefault().id ``` **After:** ```kotlin java.util.TimeZone.getDefault().id ``` Use this in the same place where `NotificationContentEntity` is constructed (the parameter that stores the system timezone ID string). No other code changes are needed. --- ## Why this is safe on newer Android - Both `ZoneId.systemDefault().id` and `TimeZone.getDefault().id` refer to the **same** system default timezone and return the **same** IANA timezone ID string (e.g. `"America/Los_Angeles"`, `"Europe/London"`). - Any downstream logic that reads this string (e.g. for display or next-run calculation) behaves identically on API 26+. - No change to data format or semantics; this is a backward-compatible drop-in replacement. --- ## Verification 1. **Build:** From a consuming app (e.g. crowd-funder-for-time-pwa) with `minSdkVersion = 23`, run a full Android build including the plugin. No compilation errors. 2. **Runtime on API 23:** On an Android 6.0 device or emulator, enable daily notifications and schedule a time. The app should not crash; the notification should be scheduled and (after the delay) fire. 3. **Runtime on API 26+:** Confirm scheduling and delivery still work as before on Android 8+. --- ## Context (consuming app) - App and plugin both declare `minSdkVersion = 23` (Android 6.0). AlarmManager, permissions, and notification paths in the plugin are already API-23 safe; this `java.time` usage is the only blocker for running on Android 6.0 devices. Use this document when applying the fix in the **daily-notification-plugin** repo (e.g. in Cursor). After changing the plugin, update the consuming app’s dependency (e.g. `npm update @timesafari/daily-notification-plugin` or point at the fixed commit), then `npx cap sync android` and rebuild.