0

I tried HapticGenerator audio effect introduced in the API level 31. The code is very simple:

if (HapticGenerator.isAvailable()) {
    val sessionId = mediaPlayer.audioSessionId
    val effect = HapticGenerator.create(sessionId)
    effect.enabled = isEnabled
}

But it does not work, there is no effect at all. Can anyone explain how it actually should work? Thanks!

P.S. my device is Samsung s22.

Alexei Artsimovich
  • 1,074
  • 7
  • 15

0 Answers0