Summary: Methods | Inherited Methods
public
abstract
class
VibratorManager
extends Object
Provides access to all vibrators from the device, as well as the ability to run them in a synchronized fashion.
If your process exits, any vibration you started will stop.
Summary
Public methods | |
|---|---|
abstract
void
|
cancel()
Turn all the vibrators off. |
abstract
Vibrator
|
getDefaultVibrator()
Returns the default Vibrator for the device. |
abstract
Vibrator
|
getVibrator(int vibratorId)
Retrieve a single vibrator by id. |
abstract
int[]
|
getVibratorIds()
List all available vibrator ids, returning a possible empty list. |
final
void
|
vibrate(CombinedVibration effect)
Vibrate with a given combination of effects. |
final
void
|
vibrate(CombinedVibration effect, VibrationAttributes attributes)
Vibrate with a given combination of effects. |
Inherited methods | |||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
From class
| |||||||||||||||||||||||
Public methods
getDefaultVibrator
public abstract Vibrator getDefaultVibrator ()
Returns the default Vibrator for the device.
| Returns | |
|---|---|
Vibrator |
This value cannot be null. |
getVibrator
public abstract Vibrator getVibrator (int vibratorId)
Retrieve a single vibrator by id.
| Parameters | |
|---|---|
vibratorId |
int: The id of the vibrator to be retrieved. |
| Returns | |
|---|---|
Vibrator |
The vibrator with given vibratorId, never null. |
getVibratorIds
public abstract int[] getVibratorIds ()
List all available vibrator ids, returning a possible empty list.
| Returns | |
|---|---|
int[] |
An array containing the ids of the vibrators available on the device.
This value cannot be null. |
vibrate
public final void vibrate (CombinedVibration effect)
Vibrate with a given combination of effects.
Pass in a CombinedVibration representing a combination of VibrationEffects to be played on one or more vibrators.
The app should be in foreground for the vibration to happen.
.
Requires Manifest.permission.VIBRATE
| Parameters | |
|---|---|
effect |
CombinedVibration: a combination of effects to be performed by one or more vibrators.
This value cannot be null. |