getConnectedWifi(params: Object)

Requires:
BaseKit≥2.4.3@ray-js/ray≥0.5.9
Platforms:
iOSAndroid
import { getConnectedWifi } from '@ray-js/ray';

// Promise usage
try {
  const res = await getConnectedWifi({ ...params });
  console.log(res);
} catch (err) {
  console.log(err.errorMsg);
}

Description

Get information about the currently connected Wi‑Fi. Note: On Android, location permission, Wi‑Fi state permission, and network permission are required; not available on iOS

Parameters

PropertyTypeRequiredDefaultDescription
partialInfobooleanNofalseWhether to return partial Wi‑Fi information Android: If thing.getConnectedWifi is called with partialInfo:true, it returns a WifiInfo object containing only the SSID property. iOS: If thing.getConnectedWifi is called with partialInfo:true, it returns a WifiInfo object containing only the SSID and BSSID properties. Default: false
complete() => voidNo-Completion callback (executed on both success and failure)
success(params: Object) => voidNo-Callback on successful API call
fail(params: Object) => voidNo-Failure callback
success callback parameters
PropertyTypeDescriptionBaseKit Since
SSIDstringWi‑Fi SSIDv3.2.6
BSSIDstringWi‑Fi BSSIDv3.2.6
signalStrengthnumberWi‑Fi signal strength. Android range: 0–100; iOS range: 0–1. Larger values indicate stronger signal.v3.2.6
securebooleanWhether the Wi‑Fi is secure Android: Supported starting from Android 12.v3.2.6
frequencynumberWi‑Fi band in MHzv3.2.6
fail callback parameters
PropertyTypeDescription
errorMsgstringError message
errorCodestring | numberError code
Error extension

Return Value

None

Examples

import { getConnectedWifi } from '@ray-js/ray'

getConnectedWifi({
  partialInfo: false,
  success: data => {
    console.log(data);
  },
  fail: error => {
    console.error(error);
  },
});