ForegroundAppSource class abstract

Where the foreground application identifier comes from.

Implement this to plug a real platform source in. The default (SelfForegroundAppSource) reports the host's own application id, which is honest and useful for an app the person is actively using, but it cannot see what is in front when the person leaves.

Platform Real source Status
Android UsageStatsManager.queryEvents (PACKAGE_USAGE_STATS, a Settings-granted permission) not built — implement this interface
iOS none exists structurally unavailable; the self source is the ceiling

A source that cannot answer right now returns null, and the reporter sends nothing rather than re-asserting a stale app.

Implementers

Constructors

ForegroundAppSource()

Properties

hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited

Methods

currentForegroundApp() → FutureOr<String?>
The application id in front, or null when unknown.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited