From 9ff779b26c8745b42f970d9e7d853a86df4130ae Mon Sep 17 00:00:00 2001 From: Hyperling Date: Sun, 8 Nov 2026 19:38:16 -0700 Subject: [PATCH] Agent thinks it fixed the crash on SDK36 and lack of interval counting down on SDK24. --- .../java/com/hyperling/apps/infinitetimer/MainActivity.java | 6 ++++-- .../apps/infinitetimer/TimerForegroundService.java | 3 +++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/hyperling/apps/infinitetimer/MainActivity.java b/app/src/main/java/com/hyperling/apps/infinitetimer/MainActivity.java index 031c50c..d1ccf39 100755 --- a/app/src/main/java/com/hyperling/apps/infinitetimer/MainActivity.java +++ b/app/src/main/java/com/hyperling/apps/infinitetimer/MainActivity.java @@ -389,7 +389,8 @@ public class MainActivity extends AppCompatActivity { // Delegate countdown logic to ForegroundService to survive Doze mode on SDK 36+ Intent svcIntent = new Intent(this, TimerForegroundService.class); svcIntent.setAction(Alert.ACTION_TIMER); - svcIntent.putExtra(TimerForegroundService.EXTRA_INTERVAL_MS, longLoopInterval); + // Pass the calculated `interval` (which includes the 60s fallback if user entered nothing) + svcIntent.putExtra(TimerForegroundService.EXTRA_INTERVAL_MS, interval); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { startForegroundService(svcIntent); } else { @@ -703,7 +704,8 @@ public class MainActivity extends AppCompatActivity { syncVolume(); // Register receiver to get live updates from ForegroundService while app is visible - registerReceiver(timerUpdateReceiver, new IntentFilter(TimerForegroundService.class.getName() + ".UPDATE")); + // RECEIVER_NOT_EXPORTED (0x00010000) is required on Android 13+ for local broadcasts + registerReceiver(timerUpdateReceiver, new IntentFilter(TimerForegroundService.class.getName() + ".UPDATE"), 0x00010000); if (DEBUG) Log.d(tag, "Finished"); } diff --git a/app/src/main/java/com/hyperling/apps/infinitetimer/TimerForegroundService.java b/app/src/main/java/com/hyperling/apps/infinitetimer/TimerForegroundService.java index a537990..3b1344e 100644 --- a/app/src/main/java/com/hyperling/apps/infinitetimer/TimerForegroundService.java +++ b/app/src/main/java/com/hyperling/apps/infinitetimer/TimerForegroundService.java @@ -64,6 +64,9 @@ public class TimerForegroundService extends Service { if (newInterval > 0) { loopIntervalMs = newInterval; endTimeMillis = System.currentTimeMillis() + loopIntervalMs; + tick(); // Start the countdown immediately when the service is launched + } else { + Log.w(TAG, "Received start command without a valid positive interval."); } return START_STICKY;