Skip to content

Vibrate

Summary

  • Internal name: Vibrate
  • Category: Notifications
  • Purpose: Vibrate the device for a given duration. The task waits until the vibration finishes before continuing.
  • Task type: Normal

Compatibility

  • Minimum AndroMate version: 1.1.0

  • Maximum AndroMate version: 1.1.0

  • Minimum Android: Android 13 (API 33)

  • Maximum Android tested: Android 16 (API 36)

  • Required permissions: VIBRATE


Detailed description

The Vibrate task triggers a one-shot vibration using the device VibratorManager. It works from the background (foreground service) without any extra restriction.

Two safety behaviors are built in:

  • Capped duration: the duration is clamped to a maximum of 10 000 ms (10 s) — a request of one hour will only vibrate for 10 seconds.
  • Waits for the end: the task blocks for the (capped) duration so that workflow timing stays deterministic and the vibration is guaranteed to complete before the next task runs.

Input parameters

Parameter Type Required Possible values / Rules Android Compatibility AndroMate Compatibility Default
duration_ms Integer No Vibration duration in ms — capped at 10000 Android 13 (API 33) → Android 16 (API 36) 1.1.0 → 1.1.0 500

Output parameters

This task produces no output variable. It returns a VoidResult.


Exceptions

This task does not throw exceptions.


Execution flowchart

flowchart TD
    Start([▶ Vibrate]) --> Cap[⛔ Clamp duration to max 10000 ms]

    Cap --> Vibrate[📳 VibratorManager.vibrate]

    Vibrate --> Wait[⏳ Wait for the duration]

    Wait --> Success([✅ VoidResult])

    style Start fill:#e3f2fd
    style Success fill:#c8e6c9
    style Cap fill:#fff9c4
    style Vibrate fill:#f3e5f5
    style Wait fill:#fff9c4

How it works:

  1. Clamp: duration_ms is capped to 10000 ms
  2. Vibrate: a one-shot vibration is triggered with the default amplitude
  3. Wait: the task blocks for the effective (capped) duration
  4. Result: returns VoidResult

Code examples

Example 1 — Short buzz

{
  "Vibrate": [
    {
      "id": "1",
      "title": "Buzz",
      "duration_ms": 500
    }
  ]
}

Example 2 — Longer vibration (still capped at 10s)

{
  "Vibrate": [
    {
      "id": "2",
      "title": "Long buzz",
      "duration_ms": 3000
    }
  ]
}

Input parameter details

duration_ms — Vibration duration

Duration of the vibration in milliseconds.

  • Default: 500
  • Maximum: 10000 ms (10 s) — any larger value is silently clamped
  • The task waits for this (capped) duration before moving on

Output parameter details

This task produces no output variable.


Complete JSON example

{
  "Vibrate": [
    {
      "id": "1",
      "title": "Vibrate",
      "duration_ms": 800
    }
  ]
}