What is the best practice for handling missing or outdated Android time zone data in apps?
23.5K reputation · 17 Mar 2024, 00:55 UTC
Goal: Provide consistent date and time formatting for users regardless of whether the device’s system tzdata package is present or up to date.
Constraints: When tzdata is missing, ZoneId.systemDefault() falls back to GMT and logs a warning; SimpleDateFormat and DateTimeFormatter can produce different zone name strings via ICU; manufacturers may replace or omit the zoneinfo file; behavior differs between API levels below 26 and newer releases.
Should developers bundle their own tzdata updates or rely on the platform’s fallback? How can an app detect a GMT fallback and inform the user about inaccurate time zone handling? What testing strategy verifies correct zone conversion on devices with stale or missing zoneinfo?