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

WeChat gadget plug-ins call API restrictions


May 17, 2021 WeChat Mini Program Development Document



The limit for plug-ins to call THE API

The APIs that plug-ins can call differ from small programs in two main ways:

  • The list of request domain names and small programs of plug-ins are independent of each other;
  • Some APIs do not allow plug-in calls (these functions do not exist under the wx object).

Some interfaces, although not available in plug-ins, can be achieved through plug-in feature pages, please refer to the plug-in feature pages.

Currently, the APIs that allow plug-in calls and their corresponding versions require the following:

Basis

Api The lowest version Note
wx.arrayBufferToBase64
wx.base64ToArrayBuffer

Make a request

Api The lowest version Note
wx.request 1.9.6

Upload and download

Api The lowest version Note
wx.downloadFile 1.9.6
wx.uploadFile 1.9.6

WebSocket

Api The lowest version Note
wx.connectSocket 1.9.6

Image

Api The lowest version Note
wx.previewImage 1.9.6
wx.chooseImage 1.9.6
wx.getImageInfo 1.9.6
wx.saveImageToPhotosAlbum 1.9.6

Recording

Api The lowest version Note
wx.startRecord 1.9.6
wx.stopRecord 1.9.6

Live audio and video

Api The lowest version Note
wx.createLivePlayerContext 1.9.6
wx.createLivePusherContext 1.9.6

Recording management

Api The lowest version Note
wx.getRecorderManager 1.9.94

Audio playback control

Api The lowest version Note
wx.pauseVoice 1.9.6
wx.playVoice 1.9.6
wx.stopVoice 1.9.6

Music playback control

Api The lowest version Note
wx.onBackgroundAudioPlay 1.9.6
wx.getBackgroundAudioPlayerState 1.9.6
wx.onBackgroundAudioStop 1.9.6
wx.stopBackgroundAudio 1.9.6
wx.onBackgroundAudioPause 1.9.6
wx.seekBackgroundAudio 1.9.6
wx.playBackgroundAudio 1.9.6
wx.pauseBackgroundAudio 1.9.6

Background audio playback management

Api The lowest version Note
wx.getBackgroundAudioManager 1.9.6

Audio component control

Api The lowest version Note
wx.createInnerAudioContext 1.9.6
wx.createAudioContext 1.9.6

Video

Api The lowest version Note
wx.chooseVideo 1.9.6
wx.saveVideoToPhotosAlbum 1.9.6

Video component control

Api The lowest version Note
wx.createVideoContext 1.9.6

Camera component control

Api The lowest version Note
wx.createCameraContext 1.9.6

The data cache

Api The lowest version Note
wx.setStorage 1.9.6
wx.getStorage 1.9.6
wx.removeStorage 1.9.6
wx.setStorageSync 1.9.6
wx.getStorageSync 1.9.6
wx.removeStorageSync 1.9.6

Get the location

Api The lowest version Note
wx.getLocation 1.9.6
wx.chooseLocation 1.9.6
wx.onLocationChange 2.8.0
wx.offLocationChange 2.9.1
wx.stopLocationUpdate 2.8.0
wx.startLocationUpdate 2.8.0

View the location

Api The lowest version Note
wx.openLocation 1.9.6

Map component control

Api The lowest version Note
wx.createMapContext 1.9.6

System information

Api The lowest version Note
wx.getSystemInfoSync 1.9.6
wx.getSystemInfo 1.9.6

Screen brightness

Api The lowest version Note
wx.setKeepScreenOn 1.9.6
wx.setScreenBrightness 1.9.6
wx.getScreenBrightness 1.9.6

The user screenshot event

Api The lowest version Note
wx.onUserCaptureScreen 1.9.6 Call only on plug-in pages
wx.offUserCaptureScreen 2.9.1 Call only on plug-in pages

Vibration

Api The lowest version Note
wx.vibrateLong 1.9.6
wx.vibrateShort 1.9.6

Mobile contacts

Api The lowest version Note
wx.addPhoneContact 1.9.6

Nfc

Api The lowest version Note
wx.sendHCEMessage 2.1.0
wx.stopHCE 2.1.0
wx.onHCEMessage 2.1.0
wx.offHCEMessage 2.9.1
wx.startHCE 2.1.0
wx.getHCEState 2.1.0

The network state

Api The lowest version Note
wx.onNetworkStatusChange 1.9.6
wx.offNetworkStatusChange 2.9.1
wx.getNetworkType 1.9.6

Accelerometer

Api The lowest version Note
wx.startAccelerometer 1.9.6
wx.stopAccelerometer 1.9.6
wx.onAccelerometerChange 1.9.6
wx.offAccelerometerChange 2.9.1

The orientation of the device

Api The lowest version Note
wx.startDeviceMotionListening 2.9.1
wx.stopDeviceMotionListening 2.9.1
wx.offDeviceMotionChange 2.9.1
wx.onDeviceMotionChange 2.9.1

Gyroscope

Api The lowest version Note
wx.startGyroscope 2.9.1
wx.stopGyroscope 2.9.1
wx.offGyroscopeChange 2.9.1
wx.onGyroscopeChange 2.9.1

Compass

Api The lowest version Note
wx.onCompassChange 1.9.6
wx.offCompassChange 2.9.1
wx.stopCompass 1.9.6
wx.startCompass 1.9.6

Dial number

Api The lowest version Note
wx.makePhoneCall 1.9.6

Sweep the code

Api The lowest version Note
wx.scanCode 1.9.6

Clipboard

Api The lowest version Note
wx.setClipboardData 1.9.6
wx.getClipboardData 1.9.6

Bluetooth

Api The lowest version Note
wx.writeBLECharacteristicValue 1.9.6
wx.startBluetoothDevicesDiscovery 1.9.6
wx.getConnectedBluetoothDevices 1.9.6
wx.notifyBLECharacteristicValueChange 1.9.6
wx.onBluetoothDeviceFound 1.9.6
wx.offBluetoothDeviceFound 2.9.1
wx.readBLECharacteristicValue 1.9.6
wx.openBluetoothAdapter 1.9.6
wx.getBLEDeviceCharacteristics 1.9.6
wx.stopBluetoothDevicesDiscovery 1.9.6
wx.onBLEConnectionStateChange 1.9.6
wx.getBluetoothDevices 1.9.6
wx.getBluetoothAdapterState 1.9.6
wx.onBluetoothAdapterStateChange 1.9.6
wx.offBluetoothAdapterStateChange 2.9.1
wx.getBLEDeviceServices 1.9.6
wx.onBLECharacteristicValueChange 1.9.6
wx.offBLECharacteristicValueChange 2.9.1
wx.createBLEConnection 1.9.6
wx.closeBluetoothAdapter 1.9.6
wx.closeBLEConnection 1.9.6
wx.notifyBLECharacteristicValueChange 1.9.6
wx.onBLEConnectionStateChange 1.9.6
wx.offBLEConnectionStateChange 2.9.1

iBeacon

Api The lowest version Note
wx.getBeacons 1.9.6
wx.startBeaconDiscovery 1.9.6
wx.onBeaconServiceChange 1.9.6
wx.offBeaconServiceChange 2.9.1
wx.onBeaconUpdate 1.9.6
wx.offBeaconUpdate 2.9.1
wx.stopBeaconDiscovery 1.9.6

Wi-Fi

Api The lowest version Note
wx.connectWifi 2.9.1
wx.getConnectedWifi 2.9.1
wx.getWifiList 2.9.1
wx.offGetWifiList 2.9.1
wx.offWifiConnected 2.9.1
wx.onEvaluateWifi 2.9.1
wx.onGetWifiList 2.9.1
wx.onWifiConnected 2.9.1
wx.presetWifiList 2.9.1
wx.setWifiList 2.9.1
wx.startWifi 2.9.1
wx.stopWifi 2.9.1

Interactive feedback

Api The lowest version Note
wx.hideLoading 1.9.6
wx.showActionSheet 1.9.6
wx.showLoading 1.9.6
wx.hideToast 1.9.6
wx.showToast 1.9.6
wx.showModal 1.9.6

Set the navigation bar

Api The lowest version Note
wx.showNavigationBarLoading 2.1.0 Call only on plug-in pages
wx.hideNavigationBarLoading 2.1.0 Call only on plug-in pages
wx.setNavigationBarColor 2.1.0 Call only on plug-in pages
wx.setNavigationBarTitle 2.1.0 Call only on plug-in pages

Background

Api The lowest version Note
wx.setBackgroundColor 2.4.0 Call only on plug-in pages
wx.setBackgroundTextStyle 2.4.0 Call only on plug-in pages

WXML node information

Api The lowest version Note
wx.createSelectorQuery 1.9.6

WXML node layout intersecting state

Api The lowest version Note
wx.createIntersectionObserver 1.9.6

Navigation

Api The lowest version Note
wx.navigateBack 2.1.0 Call only on plug-in pages
wx.navigateTo 2.2.2 Call only on plug-in pages
wx.redirectTo 2.2.2 Call only on plug-in pages
wx.switchTab 2.3.1 Call only on plug-in pages
wx.reLaunch 2.3.1 Call only on plug-in pages

Animation

Api The lowest version Note
wx.createAnimation 1.9.6

Position

Api The lowest version Note
wx.pageScrollTo 2.1.0 Call only on plug-in pages

Drawing

Api The lowest version Note
wx.createOffscreenCanvas 2.7.1
wx.canvasPutImageData 1.9.6
wx.canvasToTempFilePath 1.9.6
wx.createCanvasContext 1.9.6
wx.canvasGetImageData 1.9.6

Pull-down refresh

Api The lowest version Note
wx.stopPullDownRefresh 2.1.0 Call only on plug-in pages
wx.startPullDownRefresh 2.1.0 Call only on plug-in pages

Current account information

Api The lowest version Note
wx.getAccountInfoSync 2.2.2

Forward

Api The lowest version Note
wx.hideShareMenu 2.1.0 Call only on plug-in pages
wx.getShareInfo 2.1.0 Call only on plug-in pages
wx.showShareMenu 2.1.0 Call only on plug-in pages
wx.updateShareMenu 2.1.0 Call only on plug-in pages

Other

Api The lowest version Note
wx.getSetting 2.6.3
wx.openSetting 2.10.3
wx.reportAnalytics 1.9.6 See notes below

Sign in and get user information

This set of interfaces is only called after the user authorization is obtained from the user information feature page. O therwise, the fail is returned. See the User Information Features page for details.

Api The lowest version Note
wx.login 2.3.1
wx.getUserInfo 2.3.1

Tips:

  • wx.reportAnalytics can be called normally, but there is no statistical presentation at this time.