fix(android): use TimeZone for default zone ID to support API 23
java.time.ZoneId is available only from API 26; on Android 6 it causes NoClassDefFoundError when building NotificationContentEntity. Replaced ZoneId.systemDefault().id with TimeZone.getDefault().id (Kotlin) and getID() (Java) wherever we only need the system timezone ID string. Same IANA ID and behavior on API 26+. No data or semantic change. Worker/Scheduler still use java.time for date math; full API 23 there would require ThreeTenABP or Calendar-based logic.
This commit is contained in:
@@ -229,7 +229,7 @@ public class DailyNotificationFetcher {
|
||||
content.getTitle(),
|
||||
content.getBody(),
|
||||
content.getScheduledTime(),
|
||||
java.time.ZoneId.systemDefault().getId()
|
||||
java.util.TimeZone.getDefault().getID()
|
||||
);
|
||||
entity.priority = mapPriority(content.getPriority());
|
||||
try {
|
||||
|
||||
@@ -2711,7 +2711,7 @@ object ScheduleHelper {
|
||||
config.title ?: "Daily Notification",
|
||||
config.body ?: "",
|
||||
nextRunTime,
|
||||
java.time.ZoneId.systemDefault().id
|
||||
java.util.TimeZone.getDefault().id
|
||||
)
|
||||
entity.soundEnabled = config.sound ?: true
|
||||
entity.vibrationEnabled = config.vibration ?: true
|
||||
|
||||
@@ -740,7 +740,7 @@ public class DailyNotificationWorker extends Worker {
|
||||
content.getTitle(),
|
||||
content.getBody(),
|
||||
content.getScheduledTime(),
|
||||
java.time.ZoneId.systemDefault().getId()
|
||||
java.util.TimeZone.getDefault().getID()
|
||||
);
|
||||
entity.priority = mapPriorityToInt(content.getPriority());
|
||||
try {
|
||||
|
||||
@@ -211,7 +211,7 @@ class FetchWorker(
|
||||
title,
|
||||
body,
|
||||
notificationTime,
|
||||
java.time.ZoneId.systemDefault().id
|
||||
java.util.TimeZone.getDefault().id
|
||||
)
|
||||
entity.priority = 0 // default priority
|
||||
entity.vibrationEnabled = true
|
||||
|
||||
@@ -257,7 +257,7 @@ class NotifyReceiver : BroadcastReceiver() {
|
||||
config.title,
|
||||
config.body ?: (if (contentCache != null) String(contentCache.payload) else ""),
|
||||
triggerAtMillis,
|
||||
java.time.ZoneId.systemDefault().id
|
||||
java.util.TimeZone.getDefault().id
|
||||
)
|
||||
entity.priority = when (config.priority) {
|
||||
"high", "max" -> 2
|
||||
|
||||
@@ -273,7 +273,7 @@ class ReactivationManager(private val context: Context) {
|
||||
"Daily Notification",
|
||||
"Your daily update is ready",
|
||||
scheduledTime,
|
||||
java.time.ZoneId.systemDefault().id
|
||||
java.util.TimeZone.getDefault().id
|
||||
)
|
||||
notification.deliveryStatus = "missed"
|
||||
notification.lastDeliveryAttempt = System.currentTimeMillis()
|
||||
@@ -1043,7 +1043,7 @@ class ReactivationManager(private val context: Context) {
|
||||
"Daily Notification",
|
||||
"Your daily update is ready",
|
||||
scheduledTime,
|
||||
java.time.ZoneId.systemDefault().id
|
||||
java.util.TimeZone.getDefault().id
|
||||
)
|
||||
notification.deliveryStatus = "missed"
|
||||
notification.lastDeliveryAttempt = System.currentTimeMillis()
|
||||
|
||||
Reference in New Issue
Block a user