tencent cloud

Tencent Cloud Super App as a Service

Release Notes and Announcements
Announcement: Tencent Cloud Mini Program Platform Renamed to Tencent Cloud Super App as a Service on January 2, 2025
Console Updates
Android SDK Updates
iOS SDK Updates
Flutter SDK Updates
IDE Updates
Base Library Updates
Product Introduction
Overview
Strengths
Use Cases
Purchase Guide
Billing Overview
Pay-As-You-Go Billing
Renewal Guide
Service Suspension Instructions
Getting Started
Plan Management
Overview
Console Account Management
Storage Configuration
Acceleration Configuration
Branding Configurations
Platform Features
Console Login
Users and Permission System
Mini Program Management
Mini Game Management
Superapp Management
Commercialization
Platform Management
User Management
Team Management
Operations Management
Security Center
Code Integration Guide
Getting Demo and SDK
Android
iOS
Flutter
Superapp Server
GUID Generation Rules
Mini Program Development Guide
Mini Program Introduction and Development Environment
Mini Program Code Composition
Guide
Framework
Components
API
Server Backend
JS SDK
Base Library
IDE Operation Instructions
Mini Game Development Guide
Guide
API
Server Backend
Practice Tutorial
Mini Program Login Practical Tutorial
Mini Program Subscription Message Practical Tutorial
Payment Practical Tutorial
Ad Integration Practical Tutorial
Mini Game Subscription Message Practical Tutorial
API Documentation
History
Introduction
API Category
Making API Requests
Operation Management APIs
User Management APIs
Team Management APIs
Sensitive API-Related APIs
Role Management APIs
Platform Management APIs
Other Console APIs
Mini Program or Mini Game APIs
Management-Sensitive APIs
Global Domain Management APIs
Superapp APIs
Data Types
Agreements
Service Level Agreement
Data Processing and Security Agreement
SDK Privacy Policy Module
SDK Data Processing and Security Agreement Module

Wi-Fi

PDF
Focus Mode
Font Size
Last updated: 2026-03-20 17:56:26

onWifiConnected

This API is called using wx.onWindowResize(function listener).
Note:
Support:
Supported on Android
Supported on iOS
Feature description:Detects Wi-Fi connection.
Parameter and description:function listener. The listener for Wi-Fi connection event. See the parameter Object.res as below.
Property
Type
Note
wifi
WifiInfo
Wi-Fi information

offWifiConnected

The API is called using wx.offWindowResize(function listener).
Feature description:Removes the listener for Wi-Fi connection event.
Parameter and description:function listener. The listener passed to onWifiConnected. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onWifiConnected(listener)
wx.offWifiConnected(listener) // Must pass the same function object used in wx.onWifiConnected(listener)

stopWifi

This API is called using wx.stopWifi(Object object).
Feature description:Turns off the Wi-Fi module.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.
Example:
wx.stopWifi({
success (res) {
console.log(res.errMsg)
}
})

startWifi

This API is called using wx.startWifi(Object object).
Feature description:Initializes the Wi-Fi module.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.
Example:
wx.startWifi({
success (res) {
console.log(res.errMsg)
}
})

getWifiList

This API is called using wx.getWifiList(Object object).
Feature description:Requests the list of Wi-Fi networks. The wifiList data is returned in the callback registered with onGetWifiList. On Android, user authorization for scope.userLocation is required before calling.
On iOS, the user must manually go to the "Wi-Fi" settings page, and after the system detects available networks, the mini program can receive the onGetWifiList callback.

Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.
Example:
wx.onGetWifiList(function(res) {
if (res.wifiList.length) {
wx.setWifiList({
wifiList: [{
SSID: res.wifiList[0].SSID,
BSSID: res.wifiList[0].BSSID,
password: '123456'
}]
})
} else {
wx.setWifiList({
wifiList: []
})
}
})
wx.getWifiList()

setWifiList

This API is called using wx.setWifiList(Object object).
Feature description:Configures the relevant information for the APs in the wifiList. It must be after the onGetWifiList callback.This is an API supported only on iOS.
Note:
This API can only be called after the onGetWifiList callback is triggered.
At this point, the client will be suspended and waiting for the mini program to set the Wi-Fi information. Be sure to call this API as soon as possible. If there is no data, pass an empty array.
Due to updates in the surrounding Wi-Fi list, multiple callbacks with potentially duplicate Wi-Fi lists may be received within a single process.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
wifiList
Array.<Object>
-
True
Provides the preset list of Wi-Fi information. Each object includes:
SSID (string): Wi-Fi SSID.
BSSID (string): Wi-Fi BSSID.
password (string): Wi-Fi device password.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.
Example:
wx.onGetWifiList(function(res) {
if (res.wifiList.length) {
wx.setWifiList({
wifiList: [{
SSID: res.wifiList[0].SSID,
BSSID: res.wifiList[0].BSSID,
password: '123456'
}]
})
} else {
wx.setWifiList({
wifiList: []
})
}
})
wx.getWifiList()

onGetWifiList

This API is called using wx.onGetWifiList(function listener).
Feature description:Listens for the event when Wi-Fi list data is obtained.
Parameter and description:function listener, the event listener function that handles the received Wi-Fi list data. Parameter: Object res.
Property
Type
Description
wifiList
Array.<WifiInfo>
Wi-Fi list data

offGetWifiList

This API is called using wx.offGetWifiList(function listener).
Feature description:Removes the listener for the event when Wi-Fi list data is obtained.
Parameter and description:function listener. A listener passed to onThemeChange. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onGetWifiList(listener)
wx.offTouchStart(listener) // Must pass the same function object used in wx.onGetWifiList(listener)

onWifiConnectedWithPartialInfo

The API is called using wx.onWifiConnectedWithPartialInfo(function listener).
Feature description:Detects Wi-Fi connection.
Parameter and description:function listener, listens for the event when a Wi-Fi connection is established. Parameter: Object res.
Property
Type
Description
wifi
WifiInfo
A WifiInfo object containing only the SSID property.

offWifiConnectedWithPartialInfo

The API is called using wx.offWifiConnectedWithPartialInfo(function listener).
Feature description:Removes the listener for Wi-Fi connection event.
Parameter and description:function listener, the listener function previously passed to onWifiConnectedWithPartialInfo. If not provided, all listeners will be removed.
Example:
const listener = function (res) { console.log(res) }

wx.onWifiConnectedWithPartialInfo(listener)
wx.offWifiConnectedWithPartialInfo(listener) // Must pass the same function object used in wx.onWifiConnectedWithPartialInfo(listener)

connectWifi

This API is called using wx.connectWifi(Object object).
Feature description:Connects to a Wi-Fi network. If the Wi-Fi information is already known, this API can be used to connect directly.
Note:
On iOS, the system does not provide developers with an event indicating connection failure due to an incorrect Wi-Fi password. However, users will see a system popup if the password is incorrect. It is recommended that developers use the onWifiConnected event to determine whether the Wi-Fi connection was successful. For example, set a timer and if the onWifiConnected event is not received before the timer expires, consider the connection attempt invalid.
On both Android and iOS, if the system is already connected to the target Wi-Fi, calling this API to connect to the same Wi-Fi again will always be treated as a successful connection regardless of the password correctness, and no onWifiConnected event will be triggered.
The onWifiConnected event may sometimes return an empty object, which indicates that the Wi-Fi has been disconnected. Developers can ignore this case.
Parameter and description:Object object.
Property
Type
Default value
‍Required
Description
SSID
string
-
True
Wi-Fi device SSID.
BSSID
string
-
False
Wi-Fi device BSSID (Android only).
password
string
-
True
Wi-Fi device password.
manual
Boolean
false
False
Whether to jump to the system settings page to connect (Android only).
partialInfo
Boolean
false
False
Whether to return partial Wi-Fi info (Android only).
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.
Example:
wx.connectWifi({
SSID: '',
password: '',
success (res) {
console.log(res.errMsg)
}
})


getConnectedWifi

This API is called using wx.getConnectedWifi(Object object).
Feature description:Gets information about the connected Wi-Fi.
Parameter and description:Object object
Property
Type
Default value
‍Required
Description
partialInfo
Boolean
false
False
Whether to return partial Wi-Fi info.
success
function
-
False
Callback function for successful API calls.
fail
function
-
False
Callback function for failed API calls.
complete
function
-
False
Callback function executed after API call ends (regardless of success or failure).
object.success callback function parameter:Object res
Property
Type
Description
wifi
WifiInfo
Wi-Fi information
Error code
Error code
Error message
Description
0
ok
Normal.
12000
not init
startWifi API not called first.
12001
system not support
Current system does not support this feature.
12002
password error Wi-Fi
Incorrect password.
12003
connection timeout
Connection timed out, supported only on Android.
12004
duplicate request
Duplicate Wi-Fi connection request.
12005
wifi not turned on
Wi-Fi switch is off, supported only on Android.
12006
gps not turned on
GPS location is off, supported only on Android.
12007
user denied
User denied permission to connect to Wi-Fi.
12008
invalid SSID
Invalid SSID.
12009
system config err
System carrier configuration denies Wi-Fi connection.
12010
system internal error
Other system errors; check errmsg for detailed reason.
12011
weapp in background
The superapp cannot configure the Wi-Fi connection while running in the background.
12013
wifi config may be expired
Saved Wi-Fi configuration has expired; recommended to forget Wi-Fi and retry, supported on Android.
12014
invalid WEP / WPA password
Invalid WEP/WPA password, supported only on iOS.

WifiInfo

Feature description:Wi-Fi information.
Note:
On Android, if wx.connectWifi or wx.getConnectedWifi is called with partialInfo: true or if the wx.onWifiConnectedWithPartialInfo event is used, the returned WifiInfo object will only contain the SSID property.
On iOS, if wx.getConnectedWifi is called with partialInfo: true, the returned WifiInfo object will contain only the SSID and BSSID properties, and the user must grant location permission to the superapp for correct results.
In some cases, even if the Wi-Fi connection is successful, errors may occur when attempting to obtain the complete WifiInfo object. The specific error codes are errCode: 12010 with messages like can't gain current wifi or no wifi is connected. If developers do not need the full WifiInfo object, these errors can be avoided by using the strategies mentioned above.

Property

string SSID:Wi-Fi SSID.
string BSSID:Wi-Fi BSSID.
boolean secure:Indicates whether the Wi-Fi network is secure.
number signalStrength:The Wi-Fi signal strength; ranges from 0 to 100 on Android, and from 0 to 1 on iOS, with higher values indicating stronger signals.
number frequency:The Wi-Fi frequency band in MHz.



Help and Support

Was this page helpful?

Help us improve! Rate your documentation experience in 5 mins.

Feedback