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.
Structs§
- Background
Work Lease - A claim that important work needs the host’s background execution allowance. The allowance remains active until every outstanding lease is dropped.
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§
- acquire_
background_ work - Acquires background execution for one independent operation.
- background_
active - Whether at least one background-work lease is active.
- background_
activity - The registered background-activity handler, or
Nonewhere unsupported. - clear_
platform_ background_ activity - Removes any registered handler (tests/teardown).
- set_
platform_ background_ activity - Installs the platform background-activity handler, replacing any previous one.