Passer au contenu

@capgo/capacitor-wifi

WiFi plugin for managing device WiFi connectivity.

WiFi plugin for managing device WiFi connectivity.

  • addNetwork - Show a system dialog to add a Wi-Fi network to the device. On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled. On iOS, this connects to the network directly.
  • connect - Connect to a Wi-Fi network. On Android, this creates a temporary connection that doesn’t route traffic through the network by default. Set autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs). For a persistent connection on Android, use addNetwork() instead. On iOS, this creates a persistent connection.
  • disconnect - Disconnect from the current Wi-Fi network. On iOS, only disconnects from networks that were added via this plugin.
  • getAvailableNetworks - Get a list of available Wi-Fi networks from the last scan. Only available on Android.
MethodDescription
addNetworkShow a system dialog to add a Wi-Fi network to the device. On Android SDK 30+, this opens the system Wi-Fi settings with the network pre-filled. On iOS, this connects to the network directly.
connectConnect to a Wi-Fi network. On Android, this creates a temporary connection that doesn’t route traffic through the network by default. Set autoRouteTraffic to true to bind app traffic to the connected network (useful for local/device-hosted APs). For a persistent connection on Android, use addNetwork() instead. On iOS, this creates a persistent connection.
disconnectDisconnect from the current Wi-Fi network. On iOS, only disconnects from networks that were added via this plugin.
getAvailableNetworksGet a list of available Wi-Fi networks from the last scan. Only available on Android.
getIpAddressGet the device’s current IP address. Available on both Android and iOS.
getRssiGet the received signal strength indicator (RSSI) of the current network in dBm. Only available on Android.
getSsidGet the service set identifier (SSID) of the current network. Available on both Android and iOS.
getWifiInfoGet comprehensive information about the currently connected WiFi network. This method provides detailed network information including SSID, BSSID, IP address, frequency, link speed, and signal strength in a single call. On iOS, some fields may not be available and will be undefined.
isEnabledCheck if Wi-Fi is enabled on the device. Only available on Android.
startScanStart scanning for Wi-Fi networks. Only available on Android. Results are delivered via the ‘networksScanned’ event listener. Note: May fail due to system throttling or hardware issues.
checkPermissionsCheck the current permission status for location access. Location permission is required for Wi-Fi operations on both platforms.
requestPermissionsRequest location permissions from the user. Location permission is required for Wi-Fi operations on both platforms.
addListenerAdd a listener for the ‘networksScanned’ event. Only available on Android. This event is fired when Wi-Fi scan results are available.
removeAllListenersRemove all listeners for this plugin.
getPluginVersionGet the native plugin version.

This reference is synced from src/definitions.ts in capacitor-wifi.