https://kotlinlang.org logo
#compose-android
Title
# compose-android
a

Atul Gupta

12/06/2023, 11:30 AM
I am try using
val haptic = LocalHapticFeedback.current
and then
haptic.performHapticFeedback(HapticFeedbackType.LongPress)
in the Image onClick but haptic is not working. Does anyone faced this similar issue while using Haptic?
Code of the composable
Copy code
Image(
    modifier = Modifier.clickable(role = Role.Button) {
        haptic.performHapticFeedback(HapticFeedbackType.LongPress)
        // invoking some lambda
    },
    painter = painterResource(R.drawable.some_icon),
    contentDescription = stringResource(R.string.content_desc)
)
s

Shahzad Ansari

12/06/2023, 1:01 PM
This should work fine. Might not be it but are you testing on an emulator?
z

Zoltan Demant

12/06/2023, 1:59 PM
I believe do not disturb mode blocks these as well
a

Atul Gupta

12/06/2023, 2:18 PM
This should work fine. Might not be it but are you testing on an emulator?
I am trying in actual device..
DND
i am checking
I checked this was indeed OS settings where haptics was disabled
👍 1
3 Views