Class IOSVibrationService

java.lang.Object
com.gluonhq.attach.vibration.impl.IOSVibrationService
All Implemented Interfaces:
VibrationService

public class IOSVibrationService extends Object implements VibrationService
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Vibrates the device with the default pattern and duration
    void
    vibrate(long... pattern)
    Vibrates the device with the given pattern, which represents the number of milliseconds to turn the vibration on for, followed by how long it should be off for.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • IOSVibrationService

      public IOSVibrationService()
  • Method Details

    • vibrate

      public void vibrate()
      Description copied from interface: VibrationService
      Vibrates the device with the default pattern and duration
      Specified by:
      vibrate in interface VibrationService
    • vibrate

      public void vibrate(long... pattern)
      Description copied from interface: VibrationService
      Vibrates the device with the given pattern, which represents the number of milliseconds to turn the vibration on for, followed by how long it should be off for.

      In the simple case of a single vibration, a call of vibrate(2000) will result in the vibration running for 2 seconds before stopping.

      If a pattern is desired, multiple durations can be provided, where each odd duration represents a vibration duration, and each even duration represents an amount of time to wait. For example, a call of vibrate(1000, 1000, 2000, 2000, 3000) will result in the following pattern:

      • Vibrate for 1 second
      • Wait for 1 second
      • Vibrate for 2 seconds
      • Wait for 2 seconds
      • Vibrate for 3 seconds
      Note: the availability of this functionality is platform-restricted, and at present only Android supports it. Calling this method on iOS will result in the same vibration as calling VibrationService.vibrate()
      Specified by:
      vibrate in interface VibrationService
      Parameters:
      pattern - The pattern of durations to play the vibration for (with wait periods in between).