Engineering

Designing Granular Haptic Feedback for Prayer Notifications

Learn how to use Android VibrationEffect patterns to create distinct, eyes-free haptic identities for different prayer times in productivity apps.

Amin Shekh · November 13, 2026
Share

Mobile notifications often treat every alert as a generic event: a vibration motor spins at a fixed intensity for a fixed duration. For a utility app like Salah Companion: Prayer Times, this approach misses a significant opportunity to respect user attention. When a user is in a meeting, driving, or engaged in deep focus, they shouldn't have to unlock their phone to determine which prayer time has arrived. By utilizing the Android VibrationEffect API, we can design a granular haptic language that allows users to distinguish between Fajr, Dhuhr, Asr, Maghrib, and Isha solely through touch. This move toward eyes-free interaction aligns with our broader studio philosophy of protecting user attention, a principle we explore deeply in our work on Mindful Assistant.

The Hierarchy of Haptic Identification

Designing haptics is not about making vibrations stronger; it is about making them more legible. On modern Android devices (API 26+), we have moved beyond the binary vibrate(long milliseconds) method to VibrationEffect, which allows for amplitude control and waveform patterns. To create a system where five distinct times can be recognized, we need a hierarchy based on three variables: rhythm (cadence), duration (pulse length), and intensity (amplitude).

In our engineering tests for Salah Companion, we found that users struggle to distinguish between more than three levels of intensity. However, they are highly sensitive to rhythmic patterns. A "double-tap" feels fundamentally different from a "long-pulse." By mapping the characteristics of specific prayer times to these rhythmic patterns, we create a mnemonic device for the skin.

Mapping Patterns to the Prayer Cycle

To build a recognizable haptic vocabulary, we can align the vibration patterns with the natural flow of the day or the structure of the prayers themselves. Here is a technical breakdown of how we might map these in a VibrationEffect array:

PrayerConceptPattern DescriptionHaptic Component (ms/amplitude)
FajrThe AwakeningTwo short, crisp pulses followed by a rising long pulse.[0, 100, 50, 100, 50, 400]
DhuhrMid-Day PeakFour rapid, equal pulses (staccato).[0, 80, 80, 80, 80, 80, 80, 80]
AsrAfternoon StrengthTwo heavy, long pulses.[0, 300, 100, 300]
MaghribThe TransitionA fading pattern (strong to weak).[0, 400, 50, 200, 50, 100]
IshaFinality/RestOne very long, low-intensity vibration.[0, 600]

Implementing VibrationEffect in Kotlin

When implementing these patterns, it is vital to check for hardware capabilities. Not all Android devices support amplitude control. If you attempt to use VibrationEffect.createWaveform(timings, amplitudes, -1) on a device that only supports binary on/off states, the system will fall back to a default. We handle this by providing a simplified timing-only array for older hardware while maximizing the experience for users with high-fidelity haptic motors (like those found in Pixel or Samsung flagship devices).

```kotlin val vibrator = context.getSystemService(Context.VIBRATOR_SERVICE) as Vibrator

val timings = longArrayOf(0, 100, 50, 100, 50, 400) // Fajr Pattern val amplitudes = intArrayOf(0, 255, 0, 255, 0, 128) // Peak intensity then half intensity

if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { if (vibrator.hasAmplitudeControl()) { vibrator.vibrate(VibrationEffect.createWaveform(timings, amplitudes, -1)) } else { vibrator.vibrate(VibrationEffect.createWaveform(timings, -1)) } } ```

This approach ensures that the "Awakening" feel of Fajr is sharp and clear, while the "Rest" feel of Isha is softer but longer, occupying a different sensory space. This is a form of Designing for Information Persistence; even if the notification is dismissed or the screen is never turned on, the "shape" of the information has been delivered to the user.

Designing for Perception: The "Dead Space" Problem

One of the most common mistakes in haptic design is ignoring the silence between pulses. In a notification context, the 0 values in your timing array (the pauses) are just as important as the vibrations. If the pauses are too short (less than 40ms), the human nervous system often perceives them as a single, messy vibration rather than distinct pulses. For prayer notifications, where we want to convey a sense of calm and precision, we aim for "dead space" of at least 50-100ms.

Furthermore, consider the physical environment. A phone on a wooden table will amplify vibration intensity through resonance, potentially making a "subtle" pattern sound like a jackhammer. Conversely, a phone in a loose coat pocket might swallow subtle amplitude shifts. To solve this, we provide users with a "Haptic Intensity" slider that scales the values in the amplitudes array globally, allowing them to calibrate the feedback to their typical environment.

Accessibility and Inclusivity

Granular haptics aren't just a "power user" feature; they are a critical accessibility tool. For users with visual impairments, these distinct patterns transform the phone from a screen-dependent device into a tactile one. This mirrors our design intent in Alif2Ayah, where we focus on Designing for High-Density Scripts to ensure clarity. In the same way that typography must be legible, haptics must be "readable."

We avoid using vibration patterns that mimic standard system alerts (like the rapid double-buzz of a text message or the continuous rumble of a phone call). If a user's phone vibrates and they think they are getting a call, we have failed. The prayer notification haptic should feel unique to the app's ecosystem—sacred, scheduled, and calm.

Testing Haptic Patterns

Unlike UI components, haptics cannot be effectively tested in an emulator. We utilize a "Haptic Lab" internal tool where we can trigger patterns via a simple button grid on various physical devices.

The Three-Device Test Checklist:

  1. 1.The Flagship Test: Does the pattern take advantage of the crisp, "clicky" feel of an X-axis linear actuator?
  2. 2.The Budget Test: Does the pattern still make sense on a cheaper ERM motor, or does it just feel like a blurry buzz?
  3. 3.The Surface Test: Place the phone on a hard surface. Is the audible noise of the vibration disruptive, or is it a controlled, pleasant hum?

If a pattern fails any of these—for instance, if the Maghrib "fade" sounds like a dying motor on a budget device—we iterate on the timings until a middle ground is found. Usually, this involves increasing the gap between pulses to ensure the motor has enough time to fully spin down before the next pulse begins.

The Cognitive Load of Customization

While it is tempting to let users record their own vibration patterns, we have found that providing a well-researched set of defaults is superior for most users. Too much choice leads to "decision fatigue," a problem we frequently address when Building Guided Workflows. By providing a "Default Haptic Language," we ensure that if a user switches phones or reinstalls the app, the sensory associations they have built remain intact.

We do, however, offer a "Haptic Preview" in the settings. When a user selects a prayer time, the phone triggers the associated pattern. This reinforces the association between the vibration and the time, acting as a training phase for the user's tactile memory.

What to do next

  1. 1.Audit your current notifications: Identify if your app currently uses the default system vibration. If so, replace it with a simple longArrayOf pattern to give your app a unique tactile signature.
  2. 2.Implement the VibrationEffect API: Move away from the deprecated vibrate(long) method. Use VibrationEffect.createWaveform to start experimenting with amplitudes and rhythmic pulses.
  3. 3.Perform a "Pocket Test": Trigger your new patterns while the phone is in your pocket or a bag. If you cannot distinguish between your different alerts without looking, increase the contrast in your pulse durations.
#android engineering#haptic feedback#ux design#salah companion

One email per launch. No spam, unsubscribe any time.