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


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

Provides an implementation of DeviceConstellation backed by a FirefoxAccount.


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


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.
pollForCommandsAsync fun pollForCommandsAsync(): Deferred<Boolean>
Polls for any pending DeviceCommandIncoming commands. In case of new commands, registered AccountEventsObserver 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.
sendCommandToDeviceAsync fun sendCommandToDeviceAsync(targetDeviceId: String, outgoingCommand: DeviceCommandOutgoing): Deferred<Boolean>
Send a command 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.