public interface AccelerometerService
The AccelerometerService provides a read-only acceleration property
that is updated at regular intervals by the underlying platform implementation. A user of the
AccelerometerService can listen to changes of the acceleration force, by registering a
ChangeListener
to the
acceleration property
.
Example
Services.get(AccelerometerService.class).ifPresent(service -> {
Acceleration acceleration = accelerometerService.getCurrentAcceleration();
System.out.printf("Current acceleration: %.2f, %.2f, %.2f",
acceleration.getX(), acceleration.getY(), acceleration.getZ());
});
Android Configuration: none
iOS Configuration: none
Type | Property and Description |
---|---|
javafx.beans.property.ReadOnlyObjectProperty<Acceleration> |
acceleration
A frequently-updated reading from the accelerometer.
|
Modifier and Type | Field and Description |
---|---|
static boolean |
FILTER_GRAVITY |
static int |
FREQUENCY |
Modifier and Type | Method and Description |
---|---|
javafx.beans.property.ReadOnlyObjectProperty<Acceleration> |
accelerationProperty()
A frequently-updated reading from the accelerometer.
|
Acceleration |
getCurrentAcceleration()
Returns a single reading from the accelerometer.
|
javafx.beans.property.ReadOnlyObjectProperty<Acceleration> accelerationProperty
static final boolean FILTER_GRAVITY
static final int FREQUENCY
Acceleration getCurrentAcceleration()
javafx.beans.property.ReadOnlyObjectProperty<Acceleration> accelerationProperty()