Skip to main content

FlixelAndroidHaptics

View source

class

org.flixelgdx.backend.android.haptics.FlixelAndroidHaptics

public class FlixelAndroidHaptics implements FlixelHaptics

Android implementation of FlixelHaptics backed by the system Vibrator service.

On Android 8.0 (API 26) and above, vibration is driven by VibrationEffect for accurate amplitude control. On older API levels the deprecated Vibrator.vibrate(...) overloads are used as a fallback so that the minimum SDK (API 24) is still supported.

Requires the android.permission.VIBRATE permission in the game's AndroidManifest.xml. Without it, all calls are silently ignored by the OS.

Installed automatically by FlixelAndroidLauncher; game code should not need to instantiate this directly.

Constructors

FlixelAndroidHaptics(Activity)

public FlixelAndroidHaptics(Activity activity)

Methods

vibrate(int)

public void vibrate(int ms)

vibrate(long[], int)

public void vibrate(long[] pattern, int repeat)

cancel()

public void cancel()

isSupported()

public boolean isSupported()