From 7e2b16ddad0204add4f599d9bdeb2b5e8b0185ba Mon Sep 17 00:00:00 2001 From: Jose Olarte III Date: Fri, 27 Feb 2026 21:50:39 +0800 Subject: [PATCH] docs: add plugin handoff for Android 6.0 (API 23) ZoneId fix Add doc/plugin-feedback-android-6-api23-zoneid-fix.md for the daily-notification-plugin repo: replace java.time.ZoneId with TimeZone.getDefault().id so the plugin runs on API 23 without affecting behavior on API 26+. --- ...gin-feedback-android-6-api23-zoneid-fix.md | 71 +++++++++++++++++++ 1 file changed, 71 insertions(+) create mode 100644 doc/plugin-feedback-android-6-api23-zoneid-fix.md diff --git a/doc/plugin-feedback-android-6-api23-zoneid-fix.md b/doc/plugin-feedback-android-6-api23-zoneid-fix.md new file mode 100644 index 00000000..9da7202e --- /dev/null +++ b/doc/plugin-feedback-android-6-api23-zoneid-fix.md @@ -0,0 +1,71 @@ +# 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.