RequirementsWatcher


@UnstableApi
public final class RequirementsWatcher


Watches whether the Requirements are met and notifies the Listener on changes.

Summary

Nested types

Notified when RequirementsWatcher instance first created and on changes whether the are met.

Public fields

final Requirements

Public constructors

RequirementsWatcher(
    Context context,
    RequirementsWatcher.Listener listener,
    Requirements requirements
)

Public methods

Requirements

Returns watched Requirements.

int

Starts watching for changes.

void

Stops watching for changes.

Public fields

requirements

public final Requirements requirements

Public constructors

RequirementsWatcher

public RequirementsWatcher(
    Context context,
    RequirementsWatcher.Listener listener,
    Requirements requirements
)
Parameters
Context context

Any context.

RequirementsWatcher.Listener listener

Notified whether the Requirements are met.

Requirements requirements

The requirements to watch.

Public methods

getRequirements

public Requirements getRequirements()

Returns watched Requirements.

start

@Requirements.RequirementFlags
public int start()

Starts watching for changes. Must be called from a thread that has an associated . Listener methods are called on the caller thread.

Returns
int

Initial RequirementFlags that are not met, or 0.

stop

public void stop()

Stops watching for changes.