public interface BatteryService
Example
Services.get(BatteryService.class).ifPresent(service -> {
float batteryLevel = service.getBatteryLevel();
boolean pluggedIn = service.isPluggedIn();
});
Android Configuration: none
iOS Configuration: none
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyFloatProperty |
batteryLevel
Returns a property that will be frequently updated to reflect the current battery level.
|
javafx.beans.property.ReadOnlyBooleanProperty |
pluggedIn
Returns a property that will be updated to reflect whether the device is plugged in to an
external power source or not.
|
Modifier and Type | Method and 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.
|
javafx.beans.property.ReadOnlyFloatProperty batteryLevelProperty
getBatteryLevel()
javafx.beans.property.ReadOnlyBooleanProperty pluggedInProperty
isPluggedIn()
float getBatteryLevel()
javafx.beans.property.ReadOnlyFloatProperty batteryLevelProperty()
getBatteryLevel()
boolean isPluggedIn()
javafx.beans.property.ReadOnlyBooleanProperty pluggedInProperty()
isPluggedIn()