android-components / mozilla.components.service.fxa / FxaDeviceConstellation

FxaDeviceConstellation

class FxaDeviceConstellation : DeviceConstellation, Observable<DeviceEventsObserver> (source)

Provides an implementation of DeviceConstellation backed by a FirefoxAccount.

Constructors

Name Summary
<init> FxaDeviceConstellation(account: FirefoxAccount, scope: CoroutineScope)
Provides an implementation of DeviceConstellation backed by a FirefoxAccount.

Functions

Name Summary
ensureCapabilitiesAsync fun ensureCapabilitiesAsync(capabilities: Set<DeviceCapability>): Deferred<Boolean>
Ensure that all passed in capabilities are configured. This may involve backend service registration, or other work involving network/disc access.
initDeviceAsync fun initDeviceAsync(name: String, type: DeviceType, capabilities: Set<DeviceCapability>): Deferred<Boolean>
Register current device in the associated DeviceConstellation.
pollForEventsAsync fun pollForEventsAsync(): Deferred<Boolean>
Polls for any pending DeviceEvent events. In case of new events, registered DeviceEventsObserver observers will be notified.
processRawEventAsync fun processRawEventAsync(payload: String): Deferred<Boolean>
Process a raw event, obtained via a push message or some other out-of-band mechanism.
refreshDevicesAsync fun refreshDevicesAsync(): Deferred<Boolean>
Refreshes ConstellationState. Registered DeviceConstellationObserver observers will be notified.
registerDeviceObserver fun registerDeviceObserver(observer: DeviceConstellationObserver, owner: LifecycleOwner, autoPause: Boolean): Unit
Allows monitoring state of the device constellation via DeviceConstellationObserver. Use this to be notified of changes to the current device or other devices.
sendEventToDeviceAsync fun sendEventToDeviceAsync(targetDeviceId: String, outgoingEvent: DeviceEventOutgoing): Deferred<Boolean>
Send an event to a specified device.
setDeviceNameAsync fun setDeviceNameAsync(name: String, context: <ERROR CLASS>): Deferred<Boolean>
Set name of the current device.
setDevicePushSubscriptionAsync fun setDevicePushSubscriptionAsync(subscription: DevicePushSubscription): Deferred<Boolean>
Set a DevicePushSubscription for the current device.
state fun state(): ConstellationState?
Current state of the constellation. May be missing if state was never queried.

Extension Functions

Name Summary
loadResourceAsString fun Any.loadResourceAsString(path: String): String
Loads a file from the resources folder and returns its content as a string object.