Type Function Library system.* Return value none Revision Release 2025.3714 Keywords vibrate, haptic, taptic
Vibrates and haptic feedback on a phone. In the Corona Simulator, this will sound a system beep (macOS only).
Haptic Feedback is only supported Solar2D 2021.3660+ but classic "system.vibrate()"
works on older builds
To enable the vibrate function on Android devices, you must set the permission level in the build.settings
file.
settings = { android = { usesPermissions = { "android.permission.VIBRATE" , }, }, } |
system.vibrate([ type , style]) |
String. The possible types are "impact"
, "selection"
and "notification"
. If no value is specified the device will do a classic vibrate
String. The possible styles for "impact"
are "light"
, "medium"
and "heavy"
. The default type is "medium"
. The possible styles for "notification"
are "warning"
, "success"
and "error"
. The default type is "success"
.
--make the device vibrate system.vibrate() |
--medium impact system.vibrate( "impact" ) -- same as system.vibrate("impact", "medium") --heavy impact system.vibrate( "impact" , "heavy" ) --selection system.vibrate( "selection" ) --warning notification system.vibrate( "notification" , "warning" ) |