Open
Conversation
Allows external apps (e.g. voice assistants) to create, start, pause, resume, reset, and dismiss timers via broadcast intents. Includes handling for ForegroundServiceStartNotAllowedException on Android 12+. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Sends a response broadcast with timer IDs and names of all currently running timers, identified via active notifications. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Extracts the formatted remaining time (e.g. "04:58") from each timer's notification and includes it in the response broadcast as the timer_remaining string array. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Shows a settings entry under Notifications that takes the user to the system full-screen intent permission page. Auto-hides once permission is granted. This is needed because the permission is not granted by default on Android 14+ and there is no natural in-flow moment to request it.
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.
Summary
Adds a public broadcast intent API that allows external apps to control timers. The primary use case is voice assistant integration — for example, telling a voice assistant to set a timer, which sends a broadcast intent to create and start one. I intend to add a PR to the Dicio repo with a skill allowing it to talk to TimeR Machine via this intent system.
New module:
app-broadcastA new
app-broadcastmodule with an exportedBroadcastReceiverlistening on:Supported commands
createname(String),duration_seconds(long)starttimer_id(int) ortimer_name(String)pausetimer_id(int) ortimer_name(String)resumetimer_id(int) ortimer_name(String)resettimer_id(int) ortimer_name(String)dismisstimer_id(int) ortimer_name(String), optionallistio.github.deweyreed.timer.BROADCAST_TIMER_LIST) with arrays of running timer IDs, names, and remaining time.Timers can be targeted by either
timer_idortimer_name. Name lookup is case-insensitive and returns the first match.Architecture
TimerBroadcastReceiver— Exported receiver, handles intent routing. UsesContextCompat.startForegroundServiceto send commands toMachineService, consistent with the existing Tasker integration approach.BroadcastPresenter— Resolves timer IDs/names and maps commands to service intents. Injected via Hilt.TimerFactory— CreatesTimerEntityinstances for thecreatecommand, with a countdown step and a notifier step.FindTimerInfoByName— New use case for case-insensitive timer lookup by name, backed by a new DAO query.Limitations
Same as the Tasker integration: on Android 12+,
startForegroundServicefrom a broadcast receiver requires battery optimization to be disabled for the app. The existing whitelist guideline already covers this.Other changes
StreamMachineIntentProvider.stopAllIntent()— New method to support thedismisscommand (dismiss all timers).