컨텐츠로 바로가기

Getting Started

GitHub

설치

설치

설치 단계를 따라 설치할 수 있습니다. 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';

addNetwork

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 } from '@capgo/capacitor-wifi';
await CapacitorWifi.addNetwork({
ssid: 'MyNetwork',
password: 'mypassword',
isHiddenSsid: false,
securityType: NetworkSecurityType.WPA2_PSK
});

connect

connect

Wi-Fi 네트워크에 연결합니다. Android에서는 기본적으로 네트워크를 통해 트래픽을 라우팅하지 않습니다. autoRouteTraffic를 true로 설정하여 앱 트래픽을 연결된 네트워크에 바인딩할 수 있습니다 (로컬/장치 호스트 AP를 위한 유용한 옵션). Android에서 지속적인 연결을 사용하려면 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
});

disconnect

disconnect

현재 Wi-Fi 네트워크에서 연결을 끊습니다. iOS에서는 이 플러그인을 통해 추가된 네트워크에서만 연결을 끊습니다.

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

getAvailableNetworks

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

장치의 현재 IP 주소를 가져옵니다. Android와 iOS에서 모두 사용할 수 있습니다.

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

현재 네트워크의 수신 신호 강도 지수 (RSSI)를 dBm 단위로 가져옵니다. Android에서만 사용할 수 있습니다.

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

현재 네트워크의 서비스 세트 식별자 (SSID)를 가져옵니다. Android와 iOS에서 모두 사용할 수 있습니다.

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

현재 연결된 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가 활성화되어 있는지 확인합니다.

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

startScan

startScan

안드로이드 기기에서 Wi-Fi 네트워크를 스캔합니다. 스캔 결과는 'networksScanned' 이벤트 리스너를 통해 전달됩니다. 주의: 시스템의 속도 제한이나 하드웨어 문제로 실패할 수 있습니다.

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

checkPermissions

checkPermissions

위치 접근 권한의 현재 상태를 확인합니다. 위치 권한은 안드로이드 및 iOS両 플랫폼에서 Wi-Fi 연산을 위해 필요합니다.

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

requestPermissions

requestPermissions

사용자에게 위치 권한을 요청합니다. 위치 권한은 안드로이드 및 iOS両 플랫폼에서 Wi-Fi 연산을 위해 필요합니다.

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

네트워크 추가 옵션

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

__CAPGO_KEEP_0__

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

GetIpAddressResult

__CAPGO_KEEP_2__

__CAPGO_KEEP_0__

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

GetRssiResult

__CAPGO_KEEP_3__

__CAPGO_KEEP_0__

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

GetSsidResult

__CAPGO_KEEP_4__

__CAPGO_KEEP_0__

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

전체 WiFi 정보.

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

권한 상태.

__CAPGO_KEEP_0__

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

RequestPermissionsOptions

__CAPGO_KEEP_0__

네트워크 보안 유형.

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

NetworkSecurityType

__CAPGO_KEEP_0__

네트워크 보안 유형.

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업스트림에서 pubic API이 변경되었을 때 다시 싱크를 실행하세요.

Capgo를 사용 중이라면 Getting Started 대시보드와 Capgo를 계획하고 API를 운영하기 위해, API를 연결하세요. Capgo의 @capgo/capacitor-wifi를 사용하세요. 자연스러운 네트워크 기능을 위해 @capgo/capacitor-wifi를 사용하세요. API 개요 API 구현 세부 정보를 위해 소개 __CAPGO_KEEP_0__ 키를 위해 API Keys API 구현 세부 정보를 위해 페이지 편집 이전