시작하기
설치 단계와 이 플러그인의 전체 마크다운 가이드를 포함한 설정 명령어를 복사하세요.
Set up this Capacitor plugin in the project.
Use the package manager already used by the project.
Install these package(s): `@capgo/capacitor-wifi`
Run the required Capacitor sync/update step after installation.
Read this markdown guide for the full setup steps: https://raw.githubusercontent.com/Cap-go/website/refs/heads/main/apps/docs/src/content/docs/docs/plugins/wifi/getting-started.mdx
Use that guide for platform-specific steps, native file edits, permissions, config changes, imports, and usage setup.
If that guide references other docs pages, read them too.
설치
설치AI-Assisted Setup을 사용하여 플러그인을 설치할 수 있습니다. 다음 명령어를 사용하여 AI 도구에 Capgo 기능을 추가하세요:
npx skills add https://github.com/Cap-go/capgo-skills --skill capacitor-plugins다음 명령어를 사용하세요:
Use the `capacitor-plugins` skill from `Cap-go/capgo-skills` to install the `@capgo/capacitor-wifi` plugin in my project.만약 Manual Setup을 선호한다면, 플러그인을 설치하기 위해 다음 명령어를 실행하고 아래의 플랫폼별 지침을 따르세요:
bun add @capgo/capacitor-wifibunx cap syncImport
Import 섹션import { CapacitorWifi } from '@capgo/capacitor-wifi';API 개요
API 개요addNetwork
네트워크 추가장치에 Wi-Fi 네트워크를 추가하는 시스템 대화 상자를 표시합니다. 안드로이드 SDK 30 이상에서는 시스템 Wi-Fi 설정을 열어 네트워크를 미리 채워줍니다. iOS에서는 네트워크에 직접 연결합니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.addNetwork({ ssid: 'MyNetwork', password: 'mypassword', isHiddenSsid: false, securityType: NetworkSecurityType.WPA2_PSK});connect
네트워크 연결Wi-Fi 네트워크에 연결합니다. 안드로이드에서는 기본적으로 네트워크를 통해 트래픽을 라우팅하지 않습니다. autoRouteTraffic를 true로 설정하여 앱 트래픽을 연결된 네트워크에 바인딩할 수 있습니다 (로컬/장치 호스팅 AP의 경우 유용합니다). 안드로이드에서 지속적인 연결을 사용하려면 addNetwork() 대신 사용하세요. iOS에서는 지속적인 연결을 생성합니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.connect({ ssid: 'MyNetwork', password: 'mypassword', autoRouteTraffic: true // Android only: route app traffic through this network});클립보드 복사
import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.disconnect();getAvailableNetworks
__CAPGO_KEEP_0____CAPGO_KEEP_0__
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { networks } = await CapacitorWifi.getAvailableNetworks();networks.forEach(network => { console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);});getIpAddress
“getIpAddress” 섹션장치의 현재 IP 주소를 가져옵니다. Android 및 iOS에서 모두 사용할 수 있습니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { ipAddress } = await CapacitorWifi.getIpAddress();console.log('IP Address:', ipAddress);getRssi
“getRssi” 섹션현재 네트워크의 수신 신호 강도 지시자 (RSSI)를 dBm 단위로 가져옵니다. Android에서만 사용할 수 있습니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { rssi } = await CapacitorWifi.getRssi();console.log('Signal strength:', rssi, 'dBm');getSsid
“getSsid” 섹션현재 네트워크의 서비스 세트 식별자 (SSID)를 가져옵니다. Android 및 iOS에서 모두 사용할 수 있습니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { ssid } = await CapacitorWifi.getSsid();console.log('Connected to:', ssid);getWifiInfo
“getWifiInfo” 섹션현재 연결된 WiFi 네트워크에 대한 자세한 정보를 가져옵니다. 이 메서드는 단일 호출로 SSID, BSSID, IP 주소, 주파수, 링크 속도 및 신호 강도를 포함한 네트워크 정보를 제공합니다. iOS에서는 일부 필드가 사용할 수 없으며 undefined로 표시됩니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const info = await CapacitorWifi.getWifiInfo();console.log('Network:', info.ssid);console.log('BSSID:', info.bssid);console.log('IP:', info.ip);console.log('Frequency:', info.frequency, 'MHz');console.log('Speed:', info.linkSpeed, 'Mbps');console.log('Signal:', info.signalStrength);isEnabled
isEnabled장치에서 Wi-Fi가 활성화되어 있는지 확인합니다. Android에서만 사용 가능합니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { enabled } = await CapacitorWifi.isEnabled();console.log('WiFi is', enabled ? 'enabled' : 'disabled');startScan
startScan장치에서 Wi-Fi 네트워크를 스캔합니다. Android에서만 사용 가능합니다. 네트워크 스캔 결과는 'networksScanned' 이벤트 리스너를 통해 전달됩니다. 주의: 시스템의 속도 제한이나 하드웨어 문제로 실패할 수 있습니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.addListener('networksScanned', () => { console.log('Scan completed');});await CapacitorWifi.startScan();checkPermissions
checkPermissions장치에서 현재 위치 접근 권한 상태를 확인합니다. 위치 접근 권한은 Android 및 iOS両 플랫폼에서 Wi-Fi 연산을 위해 필요합니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const status = await CapacitorWifi.checkPermissions();console.log('Location permission:', status.location);requestPermissions
requestPermissions사용자에게 위치 접근 권한을 요청합니다. 위치 접근 권한은 Android 및 iOS両 플랫폼에서 Wi-Fi 연산을 위해 필요합니다.
import { CapacitorWifi } from '@capgo/capacitor-wifi';
const status = await CapacitorWifi.requestPermissions();if (status.location === 'granted') { console.log('Permission granted');}타입 참조
타입 참조 섹션AddNetworkOptions
네트워크 추가 옵션 섹션네트워크 추가 옵션
export interface AddNetworkOptions { /** * The SSID of the network to add * * @since 7.0.0 */ ssid: string;
/** * The password for the network (optional for open networks) * * @since 7.0.0 */ password?: string;
/** * Whether the network is hidden (Android only) * * @since 7.0.0 * @default false */ isHiddenSsid?: boolean;
/** * The security type of the network (Android only) * * @since 7.0.0 * @default NetworkSecurityType.WPA2_PSK */ securityType?: NetworkSecurityType;}ConnectOptions
네트워크 연결 옵션 섹션네트워크 연결 옵션
export interface ConnectOptions { /** * The SSID of the network to connect to * * @since 7.0.0 */ ssid: string;
/** * The password for the network (optional for open networks) * * @since 7.0.0 */ password?: string;
/** * Whether the network is hidden (Android only) * * @since 7.0.0 * @default false */ isHiddenSsid?: boolean;
/** * Whether to automatically route app traffic through the connected Wi-Fi network (Android only) * When enabled, it binds the app process to the connected network using ConnectivityManager.bindProcessToNetwork() * This is useful for connecting to local/device-hosted APs (e.g., ESP32, IoT devices) that don't have internet access. * * @since 7.0.0 * @default false */ autoRouteTraffic?: boolean;}DisconnectOptions
네트워크 연결 해제 옵션 섹션네트워크 연결 해제 옵션
export interface DisconnectOptions { /** * The SSID of the network to disconnect from (optional) * * @since 7.0.0 */ ssid?: string;}GetAvailableNetworksResult
Section titled “GetAvailableNetworksResult”getAvailableNetworks()의 결과
export interface GetAvailableNetworksResult { /** * List of available networks * * @since 7.0.0 */ networks: Network[];}GetIpAddressResult
Section titled “GetIpAddressResult”getIpAddress()의 결과
export interface GetIpAddressResult { /** * The device's IP address * * @since 7.0.0 */ ipAddress: string;}GetRssiResult
Section titled “GetRssiResult”getRssi()의 결과
export interface GetRssiResult { /** * The signal strength in dBm * * @since 7.0.0 */ rssi: number;}GetSsidResult
Section titled “GetSsidResult”getSsid()의 결과
export interface GetSsidResult { /** * The SSID of the current network * * @since 7.0.0 */ ssid: string;}WifiInfo
Wi-Fi 정보 섹션Wi-Fi 정보를 모두 확인하세요.
export interface WifiInfo { /** * The SSID (network name) of the current network * * @since 7.0.0 */ ssid: string;
/** * The BSSID (MAC address) of the access point. * Not available on iOS. * * @since 7.0.0 */ bssid?: string;
/** * The device's IP address on the network * * @since 7.0.0 */ ip: string;
/** * The network frequency in MHz. * Not available on iOS. * * @since 7.0.0 */ frequency?: number;
/** * The connection speed in Mbps. * Not available on iOS. * * @since 7.0.0 */ linkSpeed?: number;
/** * The signal strength (0-100). * Calculated from RSSI on Android. * Not available on iOS. * * @since 7.0.0 */ signalStrength?: number;}IsEnabledResult
isEnabled()의 결과 섹션isEnabled()의 결과입니다.
export interface IsEnabledResult { /** * Whether Wi-Fi is enabled * * @since 7.0.0 */ enabled: boolean;}PermissionStatus
권한 상태 섹션권한 상태입니다.
export interface PermissionStatus { /** * Location permission state * * @since 7.0.0 */ location: PermissionState;}RequestPermissionsOptions
권한 요청 옵션 섹션권한 요청 옵션입니다.
export interface RequestPermissionsOptions { /** * Permissions to request * * @since 7.0.0 */ permissions?: 'location'[];}NetworkSecurityType
네트워크 보안 유형네트워크 보안 유형
export enum NetworkSecurityType { /** * Open network with no security * * @since 7.0.0 */ OPEN = 0,
/** * WEP security * * @since 7.0.0 */ WEP = 1,
/** * WPA/WPA2 Personal (PSK) * * @since 7.0.0 */ WPA2_PSK = 2,
/** * WPA/WPA2/WPA3 Enterprise (EAP) * * @since 7.0.0 */ EAP = 3,
/** * WPA3 Personal (SAE) * * @since 7.0.0 */ SAE = 4,
/** * WPA3 Enterprise * * @since 7.0.0 */ WPA3_ENTERPRISE = 5,
/** * WPA3 Enterprise 192-bit mode * * @since 7.0.0 */ WPA3_ENTERPRISE_192_BIT = 6,
/** * Passpoint network * * @since 7.0.0 */ PASSPOINT = 7,
/** * Enhanced Open (OWE) * * @since 7.0.0 */ OWE = 8,
/** * WAPI PSK * * @since 7.0.0 */ WAPI_PSK = 9,
/** * WAPI Certificate * * @since 7.0.0 */ WAPI_CERT = 10,}실질적 진실
실질적 진실이 페이지는 플러그인의 src/definitions.ts공개 API이 업스트림에서 변경될 때 다시 싱크를 실행하세요.
시작하기
시작하기이러한 기능을 사용 중이라면 시작하기 계획 대시보드 및 API 운영을 위해 Using @capgo/capacitor-wifi native 네트워크 기능을 위해 @capgo/capacitor-wifi API 개요 native 네트워크 기능 구현에 대한 자세한 내용은 API 개요 소개 소개 구현에 대한 자세한 내용은 API 키 API 키 구현에 대한 자세한 내용은, 그리고 장치 장치 구현에 대한 자세한 내용은.