Expand description
Background execution: ask the OS to keep running briefly after the app is backgrounded, so in-flight work (e.g. draining a recognition queue) can finish instead of being suspended immediately.
The platform backend installs an implementation via
set_platform_background_activity (iOS beginBackgroundTask, Android a
foreground service). No default: background_activity returns None where
unsupported, and the app simply runs only while foregrounded.
Traits§
- Background
Activity - Marks periods of important work so the platform grants background running
time. Implementations are
Send + Sync(the app toggles activity from its worker threads).
Functions§
- background_
activity - The registered background-activity handler, or
Nonewhere unsupported. - clear_
platform_ background_ activity - Removes any registered handler (tests/teardown).
- set_
background_ active - Convenience: mark background work active/inactive (no-op where unsupported).
- set_
platform_ background_ activity - Installs the platform background-activity handler, replacing any previous one.