Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

WeChat Small Program API-Device-Vibration


May 19, 2021 WeChat Mini Program Development Document


Table of contents


wx.vibrateLong(OBJECT)

Base library 1.2.0 starts to support, and low versions need to be compatible

Long-term vibration of the phone (400ms)

OBJECT parameter description:

The name of the argument Type Required Description
success Function Whether The interface calls a successful callback function
fail Function Whether The interface calls the failed callback function
complete Function Whether Callback function at end of interface call (call succeeds, fails are executed)

wx.vibrateShort(OBJECT)

Base library 1.2.0 starts to support, and low versions need to be compatible

Make your phone vibrate for a shorter time (15ms)

OBJECT parameter description:

The name of the argument Type Required Description
success Function Whether The interface calls a successful callback function
fail Function Whether The interface calls the failed callback function
complete Function Whether Callback function at end of interface call (call succeeds, fails are executed)

Bug & Tip

  1. tip vibrateShort is only available on iPhone 7/iPhone 7 Plus and Android models
  2. tip getScreenBrightness If the auto-brightness function is turned on in Android settings, the screen brightness is automatically adjusted to the light, and the interface only gets the values that were before the auto-adjusting brightness, not the real-time brightness values.