Skip to main content
@capgo/capacitor-wifi Device APIs Open source

WiFi Capacitor plugin

Manage WiFi connectivity for your Capacitor app

Install

bun add @capgo/capacitor-wifi bunx cap sync
npm, pnpm or yarn
  • npm install @capgo/capacitor-wifi
  • pnpm add @capgo/capacitor-wifi
  • yarn add @capgo/capacitor-wifi

Guide

How to use WiFi in Capacitor

Test on device

Download the Capgo app, then scan the QR code.

WiFi plugin preview QR code

Using @capgo/capacitor-wifi

WiFi plugin for managing device WiFi connectivity.

Install

bun add @capgo/capacitor-wifi
bunx cap sync

What This Plugin Exposes

  • 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.

Example Usage

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.

import { CapacitorWifi, NetworkSecurityType } from '@capgo/capacitor-wifi';

await CapacitorWifi.addNetwork({
  ssid: 'MyNetwork',
  password: 'mypassword',
  isHiddenSsid: false,
  securityType: NetworkSecurityType.WPA2_PSK
});

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.

import { CapacitorWifi } from '@capgo/capacitor-wifi';

await CapacitorWifi.connect({
  ssid: 'MyNetwork',
  password: 'mypassword',
  autoRouteTraffic: true // Android only: route app traffic through this network
});

disconnect

Disconnect from the current Wi-Fi network. On iOS, only disconnects from networks that were added via this plugin.

import { CapacitorWifi } from '@capgo/capacitor-wifi';

await CapacitorWifi.disconnect();

getAvailableNetworks

Get a list of available Wi-Fi networks from the last scan. Only available on Android.

import { CapacitorWifi } from '@capgo/capacitor-wifi';

const { networks } = await CapacitorWifi.getAvailableNetworks();
networks.forEach(network => {
  console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);
});

Full Reference

Keep going from Using @capgo/capacitor-wifi

If you are using Using @capgo/capacitor-wifi to plan dashboard and API operations, connect it with @capgo/capacitor-wifi for the implementation detail in @capgo/capacitor-wifi, Getting Started for the implementation detail in Getting Started, API Overview for the implementation detail in API Overview, Introduction for the implementation detail in Introduction, and API Keys for the implementation detail in API Keys.

FAQ

WiFi plugin FAQ

How do I install the WiFi plugin in a Capacitor app?

Run "bun add @capgo/capacitor-wifi" (or "npm install @capgo/capacitor-wifi"), then run "bunx cap sync" so the iOS and Android projects pick up the native code. Import it from "@capgo/capacitor-wifi" in your app code.

Does @capgo/capacitor-wifi work with React, Vue and Angular?

Yes. WiFi is a Capacitor package, so it works with any web framework that runs inside Capacitor, including Ionic, React, Vue, Angular, Svelte and plain JavaScript.

Which Capacitor version does @capgo/capacitor-wifi support?

Capgo plugins follow Capacitor's major version: use the plugin major version that matches your Capacitor major version (for example plugin v8 with Capacitor 8). The compatibility table in the GitHub README lists the maintained versions.

Is @capgo/capacitor-wifi free and open source?

Yes. The source code is public on GitHub at https://github.com/Cap-go/capacitor-wifi/ and the package is free to install from npm. Bug reports and pull requests are welcome.

Can I update code that uses WiFi without an App Store review?

Installing or upgrading the plugin changes native code, so it needs a new store build. After that, JavaScript, HTML and CSS changes that call the plugin can ship instantly with Capgo live updates.

Ship WiFi changes without waiting for app review

Once the plugin is in your store build, Capgo live updates push your JavaScript, HTML and CSS changes to users in minutes.

Start with Capgo