# wx.connectWifi(Object object)

Start from base library version 1.6.0. Please remaining backward compatible.

with Promise style call: Supported

Mini Program plugin: Support, need to Mini Program base library version no less than 2.9.1

Connect Wi-Fi。 If we know Wi-Fi Information that can be directly connected using this interface. only Android and iOS 11 The above version supports.

# parameter

# Object object

attribute type Default values Required Introductions Minimum version
SSID string yes Wi-Fi equipment SSID
BSSID string no Wi-Fi equipment BSSID
password string yes Wi-Fi Device Password
maunal boolean false no Jump to the system settings page to connect, Android only 2.12.0
success function no Interface calls the successful callback function
fail function no Interface calls failed callback functions
complete function no Callback function at the end of an interface call (both successful and unsuccessful calls are executed)

# error

Error code Error message Introductions
0 ok normal
12000 not init Uncalled startWifi interface
12001 system not support Current system does not support related capabilities
12002 password error Wi-Fi Password error
12003 connection timeout Connection Timeout
12004 duplicate request Repeat connection Wi-Fi
12005 wifi not turned on Android Unique, unopened Wi-Fi switch
12006 gps not turned on Android Unique, unopened GPS Positioning switch
12007 user denied User denied authorization link Wi-Fi
12008 invalid SSID invalid SSID
12009 system config err System Operator Configuration Denial of Connection Wi-Fi
12010 system internal error Other system errors require a errmsg Print the specific reason for the error
12011 weapp in background Application cannot be configured in the background Wi-Fi
12013 wifi config may be expired System saved Wi-Fi Configuration expired, recommended to forget Wi-Fi Retry

# sample code

  SSID: '',
  password: '',
  success (res) {

# Be careful

Android 7.0.22 Above WeChat connectWifi Implementation on Android Mobile phones 10 and above are not valid for Android 10 Mobile phones and above Connect wifi After that, (due to system capacity limitations) other processes cannot use the current connection wifiConfiguration maunal Connected wifi Is where the whole device works.