-
-
Notifications
You must be signed in to change notification settings - Fork 17
fix: simple timer restart after 15 minutes#39
Merged
PranavPurwar merged 2 commits intoaload0:main from Jan 28, 2026
Merged
Conversation
Android checks every 15 minutes if service is alive with an intent whose action is null. MainActivity now starts FocusModeService with the ACTION_START intent action. FocusModeService handles ACTION_START explicitly in onStartCommand, improving intent handling and service control.
Updated onStartCommand to call promoteToForeground only when the intent action is not ACTION_PAUSE, preventing unnecessary foreground promotion when pausing the timer. Removes unnecessary stopSelf that killed the timer on null actions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
This pull request refines how the
FocusModeServiceis started and managed, ensuring that the service is only initiated with explicit intent actions and improving the clarity and safety of service lifecycle management. The changes primarily affect how the service is started fromMainActivityand how it handles incoming intents.Service Start and Intent Handling Improvements:
MainActivity.kt: Updated the call tostartForegroundServiceto include theACTION_STARTintent action, ensuring the service is always started with a clear action.FocusModeService.kt: Added a new constantACTION_STARTfor the explicit start action.FocusModeService.kt: ChangedonStartCommandto stop the service immediately if the intent action is null, usingstopSelfResult(startId), and only start the timer when theACTION_STARTaction is received.Minor Code Quality Improvements:
FocusModeService.kt: Minor formatting clean-up in variable declarations.