컨텐츠로 바로가기

Getting Started

GitHub

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-wifi
bunx cap sync
import { CapacitorWifi } from '@capgo/capacitor-wifi';

SDK 30 이상의 안드로이드에서 Wi-Fi 설정을 열고 네트워크를 미리 채워줍니다. iOS에서는 네트워크에 직접 연결합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.addNetwork({
ssid: 'MyNetwork',
password: 'mypassword',
isHiddenSsid: false,
securityType: NetworkSecurityType.WPA2_PSK
});

__CAPGO_KEEP_0__ 연결 섹션

import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.connect({
ssid: 'MyNetwork',
password: 'mypassword',
autoRouteTraffic: true // Android only: route app traffic through this network
});

현재 Wi-Fi 네트워크에서断속합니다. iOS에서만 네트워크가 이 플러그인으로 추가된 네트워크만断속합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.disconnect();

getAvailableNetworks

네트워크 목록

최근 스캔에서 이용 가능한 Wi-Fi 네트워크 목록을 가져옵니다. Android에서만 이용 가능합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { networks } = await CapacitorWifi.getAvailableNetworks();
networks.forEach(network => {
console.log(`SSID: ${network.ssid}, Signal: ${network.rssi} dBm`);
});

getIpAddress

IP 주소

장치의 현재 IP 주소를 가져옵니다. Android와 iOS에서 모두 이용 가능합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { ipAddress } = await CapacitorWifi.getIpAddress();
console.log('IP Address:', ipAddress);

getRssi

RSSI

현재 네트워크의 수신 신호 강도(RSSI)를 dBm 단위로 가져옵니다. Android에서만 이용 가능합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { rssi } = await CapacitorWifi.getRssi();
console.log('Signal strength:', rssi, 'dBm');

__CAPGO_KEEP_2__

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { ssid } = await CapacitorWifi.getSsid();
console.log('Connected to:', ssid);

getWifiInfo

__CAPGO_KEEP_3__

__CAPGO_KEEP_4__

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);

__CAPGO_KEEP_6__

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const { enabled } = await CapacitorWifi.isEnabled();
console.log('WiFi is', enabled ? 'enabled' : 'disabled');

__CAPGO_KEEP_8__

import { CapacitorWifi } from '@capgo/capacitor-wifi';
await CapacitorWifi.addListener('networksScanned', () => {
console.log('Scan completed');
});
await CapacitorWifi.startScan();

checkPermissions

__CAPGO_KEEP_1__

__CAPGO_KEEP_2__ 위치 접근 권한 상태를 확인하세요. 위치 접근 권한은 Wi-Fi 연동을 위해 필요합니다.

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const status = await CapacitorWifi.checkPermissions();
console.log('Location permission:', status.location);

__CAPGO_KEEP_0__

import { CapacitorWifi } from '@capgo/capacitor-wifi';
const status = await CapacitorWifi.requestPermissions();
if (status.location === 'granted') {
console.log('Permission granted');
}

__CAPGO_KEEP_2__

__CAPGO_KEEP_3__

AddNetworkOptions

__CAPGO_KEEP_0__

__CAPGO_KEEP_4__

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;
}

네트워크에 연결하기 위한 옵션입니다.

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;
}

네트워크에서 연결을 해제하기 위한 옵션입니다.

export interface DisconnectOptions {
/**
* The SSID of the network to disconnect from (optional)
*
* @since 7.0.0
*/
ssid?: string;
}

GetAvailableNetworksResult

가용 네트워크 결과

getAvailableNetworks()의 결과입니다.

export interface GetAvailableNetworksResult {
/**
* List of available networks
*
* @since 7.0.0
*/
networks: Network[];
}

GetIpAddressResult

IP 주소 결과

getIpAddress()의 결과입니다.

export interface GetIpAddressResult {
/**
* The device's IP address
*
* @since 7.0.0
*/
ipAddress: string;
}

GetRssiResult

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

export interface GetRssiResult {
/**
* The signal strength in dBm
*
* @since 7.0.0
*/
rssi: number;
}

GetSsidResult

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

export interface GetSsidResult {
/**
* The SSID of the current network
*
* @since 7.0.0
*/
ssid: string;
}

__CAPGO_KEEP_3__

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

__CAPGO_KEEP_0__

__CAPGO_KEEP_1__

export interface IsEnabledResult {
/**
* Whether Wi-Fi is enabled
*
* @since 7.0.0
*/
enabled: boolean;
}

권한 상태.

export interface PermissionStatus {
/**
* Location permission state
*
* @since 7.0.0
*/
location: PermissionState;
}

권한 요청 옵션.

export interface RequestPermissionsOptions {
/**
* Permissions to request
*
* @since 7.0.0
*/
permissions?: 'location'[];
}

네트워크 보안 유형.

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. upstream의 API이 변경될 때 다시 싱크를 실행하세요.

Getting Started에서 계속

Getting Started에서 계속하는 섹션

Capacitor를 사용 중이라면 Getting Started Capacitor를 사용하여 대시보드와 API를 계획하고 운영하기 위해 연결하세요. Capacitor를 사용하여 @capgo/capacitor-wifi Capacitor를 사용하여 @capgo/capacitor-wifi의 네이티브 기능 API 개요 API 개요의 구현 세부 정보 소개 소개의 구현 세부 정보 API 키 implementation 세부 정보에 대한 API 키 장치 implementation 세부 정보에 대한 장치.