Module com.gluonhq.attach.battery
Package com.gluonhq.attach.battery.impl
Class AndroidBatteryService
- java.lang.Object
-
- com.gluonhq.attach.battery.impl.AndroidBatteryService
-
- All Implemented Interfaces:
BatteryService
public class AndroidBatteryService extends java.lang.Object implements BatteryService
-
-
Constructor Summary
Constructors Constructor Description AndroidBatteryService()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description javafx.beans.property.ReadOnlyFloatProperty
batteryLevelProperty()
Returns a property that will be frequently updated to reflect the current battery level.float
getBatteryLevel()
Returns the current battery level of the device as a float between 0 and 1 (inclusive), where 0 indicates the battery is completely empty, and 1 indicates that the battery is fully charged.boolean
isPluggedIn()
A boolean representing whether the device is currently receiving power from an external source (i.e.javafx.beans.property.ReadOnlyBooleanProperty
pluggedInProperty()
Returns a property that will be updated to reflect whether the device is plugged in to an external power source or not.
-
-
-
Method Detail
-
getBatteryLevel
public float getBatteryLevel()
Description copied from interface:BatteryService
Returns the current battery level of the device as a float between 0 and 1 (inclusive), where 0 indicates the battery is completely empty, and 1 indicates that the battery is fully charged.- Specified by:
getBatteryLevel
in interfaceBatteryService
- Returns:
- A float value between 0 and 1 to indicate battery charge levels.
-
batteryLevelProperty
public javafx.beans.property.ReadOnlyFloatProperty batteryLevelProperty()
Description copied from interface:BatteryService
Returns a property that will be frequently updated to reflect the current battery level.- Specified by:
batteryLevelProperty
in interfaceBatteryService
- Returns:
- A property containing the current battery level.
-
isPluggedIn
public boolean isPluggedIn()
Description copied from interface:BatteryService
A boolean representing whether the device is currently receiving power from an external source (i.e. it is not running on battery power).- Specified by:
isPluggedIn
in interfaceBatteryService
- Returns:
- Returns true to indicate power is coming from an external source, and false to indicate that the battery is powering the device.
-
pluggedInProperty
public javafx.beans.property.ReadOnlyBooleanProperty pluggedInProperty()
Description copied from interface:BatteryService
Returns a property that will be updated to reflect whether the device is plugged in to an external power source or not.- Specified by:
pluggedInProperty
in interfaceBatteryService
- Returns:
- A property containing the plugged-in status of the device.
-
-