{"_id":"@elsonkjimmy/g4-wifi-manager","name":"@elsonkjimmy/g4-wifi-manager","dist-tags":{"latest":"1.2.3"},"versions":{"1.2.3":{"name":"@elsonkjimmy/g4-wifi-manager","version":"1.2.3","description":"A customized version of react-native-wifi-reborn for the Quiz-G4 project.","types":"lib/types/index.d.ts","main":"src/index.js","scripts":{"lint":"eslint src/ lib/ plugin/ --ext .js,.jsx,.ts,.tsx","test":"echo \"No test specified\" && exit 0","build:plugin":"tsc --build plugin","checkjs":"tsc","semantic-release":"semantic-release"},"keywords":["react","react-native","android","ios","wifi","connect","quiz-g4"],"author":{"name":"elsonkjimmy"},"repository":{"type":"git","url":"git+https://github.com/elsonkjimmy/quiz-g4-wifi-manager.git"},"peerDependencies":{"react-native":">=0.13"},"dependencies":{},"bugs":{"url":"https://github.com/elsonkjimmy/quiz-g4-wifi-manager/issues"},"homepage":"https://github.com/elsonkjimmy/quiz-g4-wifi-manager#readme","license":"ISC","devDependencies":{"@babel/core":"^7.8.3","@expo/config-plugins":"^4.0.7","@semantic-release/changelog":"^6.0.3","@semantic-release/git":"^10.0.1","@types/react-native":"^0.61.17","@typescript-eslint/eslint-plugin":"^2.21.0","@typescript-eslint/parser":"^2.21.0","eslint":"^6.8.0","eslint-config-prettier":"^6.10.0","eslint-plugin-prettier":"^3.1.2","prettier":"^1.19.1","react":"^16.9.0","react-native":"^0.61.5","semantic-release":"^23.0.2","typescript":"^3.8.2"},"_id":"@elsonkjimmy/g4-wifi-manager@1.2.3","gitHead":"2b893f4810b29c513aefd95775ba7c2441009710","_nodeVersion":"20.20.2","_npmVersion":"10.8.2","dist":{"integrity":"sha512-0r1tuma0W5EFaeQswWncMrAwQY5WtwWV6o873LBoqoIr0K74rqeSyWZaJzFaKj2gVKt7j3eAnvg8VIF/3k3Kng==","shasum":"a84958c2736404154968123b690576bf54316711","tarball":"https://registry.npmjs.org/@elsonkjimmy/g4-wifi-manager/-/g4-wifi-manager-1.2.3.tgz","fileCount":35,"unpackedSize":120390,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEYCIQDhL3uMEp05JtDoIf1y2NHPLA55ovnHZMCAUNZTLF4RXwIhAK+bQv8ElHEwL2khYwTKYs/vbiDB4nRjOCRKqXtNmoiD"}]},"_npmUser":{"name":"elsonkjimmy","email":"elsonkjimmy@gmail.com"},"directories":{},"maintainers":[{"name":"elsonkjimmy","email":"elsonkjimmy@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/g4-wifi-manager_1.2.3_1781547833962_0.8985018349739573"},"_hasShrinkwrap":false}},"time":{"created":"2026-06-15T18:23:53.772Z","1.2.3":"2026-06-15T18:23:54.103Z","modified":"2026-06-15T18:23:54.283Z"},"maintainers":[{"name":"elsonkjimmy","email":"elsonkjimmy@gmail.com"}],"description":"A customized version of react-native-wifi-reborn for the Quiz-G4 project.","homepage":"https://github.com/elsonkjimmy/quiz-g4-wifi-manager#readme","keywords":["react","react-native","android","ios","wifi","connect","quiz-g4"],"repository":{"type":"git","url":"git+https://github.com/elsonkjimmy/quiz-g4-wifi-manager.git"},"author":{"name":"elsonkjimmy"},"bugs":{"url":"https://github.com/elsonkjimmy/quiz-g4-wifi-manager/issues"},"license":"ISC","readme":"# @elsonkjimmy/g4-wifi-manager\n\n[![ISC License](https://img.shields.io/badge/license-ISC-blue.svg)](./LICENSE)\n[![Current npm package version](http://img.shields.io/npm/v/@elsonkjimmy/g4-wifi-manager.svg)](https://npmjs.org/package/@elsonkjimmy/g4-wifi-manager)\n\n## Getting started\n\n`$ npm install @elsonkjimmy/g4-wifi-manager`\n\n### ⚪iOS requirements\n\nYour `Info.plist` will need to include `NSLocalNetworkUsageDescription` permission to join other networks. \n\nBeforehand in XCode, you need use enable `Access WIFI Information` to access Wi-Fi information in project settings - '+ Capability'\n\n![image](https://github.com/user-attachments/assets/4014a442-a7bc-42a6-ba52-f7d241e3e45c)\n\n`Hotspot Configuration` is also required in order to connect to networks.\n![image](https://github.com/user-attachments/assets/c064f8a4-267d-4a46-b62b-a4827bcfbaf8)\n\n**Please make sure your profile support these two capabilities above.**\n\n### ⚪iOS 13 requirements\n\nYou need put \"Privacy - Location When In Use Usage Description\" or \"Privacy - Location Always and When In Use Usage Description\" in Settings -> info\n\n### 🟢Android requirements\n\n#### `ACCESS_FINE_LOCATION` permission\n\nSince [Android 6](https://developer.android.com/about/versions/marshmallow), you must request the [`ACCESS_FINE_LOCATION`](https://developer.android.com/reference/android/Manifest.permission#ACCESS_FINE_LOCATION) permission at runtime to use the device's Wi-Fi scanning and managing capabilities. In order to accomplish this, you can use the [PermissionsAndroid API](https://reactnative.dev/docs/permissionsandroid) or [React Native Permissions](https://github.com/react-native-community/react-native-permissions).\n\nExample:\n```javascript\nimport { PermissionsAndroid } from 'react-native';\n\nconst granted = await PermissionsAndroid.request(\n  PermissionsAndroid.PERMISSIONS.ACCESS_FINE_LOCATION,\n  {\n    title: 'Location permission is required for WiFi connections',\n    message:\n      'This app needs location permission as this is required  ' +\n      'to scan for wifi networks.',\n    buttonNegative: 'DENY',\n    buttonPositive: 'ALLOW',\n  },\n);\nif (granted === PermissionsAndroid.RESULTS.GRANTED) {\n  // You can now use react-native-wifi-reborn\n} else {\n  // Permission denied\n}\n```\n\n### Autolinking (React Native 60+)\n\nThis library is correctly autolinked on React Native 60+ 🎉.\n\n<details>\n  <summary>Manual linking (for React Native 0.59 and below)</summary>\n\n  Run: `react-native link react-native-wifi-reborn`\n\n  ⚪**iOS**\n  \n  1. In XCode, in the project navigator, right click `Libraries` ➜ `Add Files to [your project's name]`\n\n  2. Go to `node_modules` ➜ `react-native-wifi-reborn` and add `RNWifi.xcodeproj`\n\n  3. In XCode, in the project navigator, select your project. Add `libRNWifi.a` to your project's `Build Phases` ➜ `Link Binary With Libraries`\n\n  4. Run your project (`Cmd+R`)\n\n  🟢**Android**\n  \n  1. Open up `android/app/src/main/java/[...]/MainActivity.java`\n\n  2. Add `import com.reactlibrary.rnwifi.RNWifiPackage;` to the imports at the top of the file\n\n  3. Add `new RNWifiPackage()` to the list returned by the `getPackages()` method\n\n  4. Append the following lines to `android/settings.gradle`:\n\n    include ':react-native-wifi-reborn'\n    \n    project(':react-native-wifi-reborn').projectDir = new File(rootProject.projectDir, \t'../node_modules/react-native-wifi-reborn/android')\n\n  5. Insert the following lines inside the dependencies block in `android/app/build.gradle`:\n \n    implementation project(':react-native-wifi-reborn')\n\n</details>\n\n### Prebuild Plugin\n\n> This package cannot be used in the \"Expo Go\" app because [it requires custom native code](https://docs.expo.io/workflow/customizing/).\n\nAfter installing this npm package, add the [config plugin](https://docs.expo.io/guides/config-plugins/) to the [`plugins`](https://docs.expo.io/versions/latest/config/app/#plugins) array of your `app.json` or `app.config.js`:\n\n```json\n{\n  \"expo\": {\n    \"ios\": {\n      \"infoPlist\": {\n        \"NSLocalNetworkUsageDescription\": \"The app requires access to the local network so it can...\"\n      }\n    },\n    \"plugins\": [\"react-native-wifi-reborn\"]\n  }\n}\n```\n\nNext, rebuild your app as described in the [\"Adding custom native code\"](https://docs.expo.io/workflow/customizing/) guide.\n\n### Props\n\nThe plugin provides props for extra customization. Every time you change the props or plugins, you'll need to rebuild (and `prebuild`) the native app. If no extra properties are added, defaults will be used.\n\n- `fineLocationPermission` (_false | undefined_): When `false`, the `android.permission.ACCESS_FINE_LOCATION` will not be added to the `AndroidManifest.xml`.\n\n### Example\n\n```json\n{\n  \"plugins\": [\n    [\n      \"react-native-wifi-reborn\",\n      {\n        \"fineLocationPermission\": false\n      }\n    ]\n  ]\n}\n```\n\n## Usage then/catch\n\n```js\nimport WifiManager from \"react-native-wifi-reborn\";\n\nWifiManager.connectToProtectedSSID(ssid, password, isWep, isHidden).then(\n  () => {\n    console.log(\"Connected successfully!\");\n  },\n  () => {\n    console.log(\"Connection failed!\");\n  }\n);\n\nWifiManager.getCurrentWifiSSID().then(\n  ssid => {\n    console.log(\"Your current connected wifi SSID is \" + ssid);\n  },\n  () => {\n    console.log(\"Cannot get current SSID!\");\n  }\n);\n```\n\n## Usage async/await\n```js\nimport WifiManager from \"react-native-wifi-reborn\";\n\nasync function main(ssid, password, isWep, isHidden) {\n  try {\n    await WifiManager.connectToProtectedSSID(ssid, password, isWep, isHidden);\n    console.log(\"Connected successfully!\");\n  } catch (error) {\n    console.log(\"Connection failed!\");\n  }\n\n  try {\n    const currentSSID = await WifiManager.getCurrentWifiSSID();\n    console.log(`Your current Wi-Fi SSID is ${currentSSID}`);\n  } catch (error) {\n    console.log(\"Cannot get current SSID!\");\n  }\n}\n```\n\n## IoT devices (🟢Android)\nIf you need to connect and send data to IoT devices, add a `network_security_config.xml` file with the following content:\n```xml\n<?xml version=\"1.0\" encoding=\"utf-8\"?>\n<network-security-config>\n    <domain-config cleartextTrafficPermitted=\"true\">\n        <domain includeSubdomains=\"true\">IP_ADDRESS</domain>\n    </domain-config>\n</network-security-config>\n```\nReplace `IP_ADDRESS` with your device IP for example `192.168.4.1`.\n\nEdit also your `AndroidManifest.xml` and add this line into `<application`:\n```xml\n<application\n  ...\n  android:networkSecurityConfig=\"@xml/network_security_config\"\n>\n```\n\n## Methods supported by 🟢Android and ⚪iOS\n\nThe following methods work on both Android and iOS\n\n### `connectToProtectedSSID(SSID: string, password: string, isWEP: boolean, isHidden: boolean): Promise`\n\nReturns a promise that resolves when connected or rejects with the error when it couldn't connect to the wifi network.\n\n#### SSID\n\nType: `string`\n\nThe SSID of the wifi network to connect with.\n\n#### password\n\nType: `string`\n\nThe password of the wifi network to connect with.\n\n#### isWep\n\nType: `boolean`\nUsed on iOS. If true, the network is WEP Wi-Fi; otherwise it is a WPA or WPA2 personal Wi-Fi network.\n\n#### isHidden\n\nType: `boolean`\nUsed on Android. If true, the network is a hidden Wi-Fi network.\n\n### `connectToProtectedWifiSSID({ ssid: string, password: string, isWEP: boolean, isHidden: boolean, timeout: number }): Promise`\nSame params as above but passed as an object and with a timeout parameter added.\n\n#### timeout\n\nType: `number`\nUsed on Android to set a timeout in seconds. Default 15 seconds.\n\n#### Errors:\n* ⚪iOS:\n  * `unavailableForOSVersion`: Starting from iOS 11, NEHotspotConfigurationError is available.\n  * `invalid`: If an unknown error is occurred.\n  * `invalidSSID`: If the SSID is invalid.\n  * `invalidSSIDPrefix`: If the SSID prefix is invalid.\n  * `invalidPassphrase`: If the passphrase is invalid.\n  * `userDenied`: If the user canceled the request to join the asked network.\n  * `locationPermissionDenied`: Starting from iOS 13, location permission is denied.\n  * `locationPermissionRestricted`: Starting from iOS 13, location permission is restricted.\n  * `couldNotDetectSSID`: If the SSID couldn't be detected.\n* 🟢Android:\n  * `locationPermissionMissing`: Starting android 6, location permission needs to be granted for wifi scanning.\n  * `locationServicesOff`: Starting Android 6, location services needs to be on to scan for wifi networks.\n  * `couldNotEnableWifi`: Starting Android 10, apps are no longer allowed to enable wifi. User has to manually do this.\n  * `couldNotScan`: Starting Android 9, it's only allowed to scan 4 times per 2 minuts in a foreground app.\n  * `didNotFindNetwork`: If the wifi network is not in range, the security type is unknown and WifiUtils doesn't support connecting to the network.\n  * `authenticationErrorOccurred`: Authentication error occurred while trying to connect. The password could be incorrect or the user could have a saved network configuration with a different password!\n  * `android10ImmediatelyDroppedConnection` : Firmware bugs on OnePlus prevent it from connecting on some firmware versions. More info: https://github.com/ThanosFisherman/WifiUtils/issues/63.\n  * `timeoutOccurred`: Could not connect in the timeout window. - ```ONLY NEW VERSION```\n* 🟢⚪Both:\n  * `unableToConnect`: When an unknown error occurred.\n\n### `getCurrentWifiSSID(): Promise`\n\nReturns the SSID of the current WiFi network.\n\n#### Errors:\n * `couldNotDetectSSID`: Not connected or connecting.\n\n## Methods supported by ⚪iOS ONLY\n\nThe following methods work only on iOS\n\n###  `connectToSSID(ssid: string): Promise`\n\n###  `connectToSSIDPrefix(ssid: string): Promise`\n\n### `disconnectFromSSID(ssid: string): Promise`\n\n### `connectToProtectedSSIDOnce(SSID: string, password: string, isWEP: boolean, joinOnce: boolean): Promise`\n\n### `connectToProtectedSSIDPrefix(SSIDPrefix: string, password: string, isWep: boolean): Promise`\n\n### `connectToProtectedSSIDPrefixOnce(SSIDPrefix: string, password: string, isWep: boolean, joinOnce: boolean): Promise`\n\nUse this function when you want to match a known SSID prefix, but don’t have a full SSID. If the system finds multiple Wi-Fi networks whose SSID string matches the given prefix, it selects the network with the greatest signal strength.\n\n#### SSIDPrefix\nType: `string`\nA prefix string to match the SSID of a Wi-Fi network.\n\n#### password\nType: `string`\nThe password of the wifi network to connect with.\n\n#### isWep\nType: `boolean`\nUsed on iOS. If YES, the network is WEP Wi-Fi; otherwise it is a WPA or WPA2 personal Wi-Fi network.\n\n#### joinOnce\nType: `boolean`\nUsed on iOS. Optional param. Defaults to `false`. When joinOnce is set to true, the hotspot remains configured and connected only as long as the app that configured it is running in the foreground. The hotspot is disconnected and its configuration is removed when any of the following events occurs:\n\n* The app stays in the background for more than 15 seconds.\n\n* The device sleeps.\n\n* The app crashes, quits, or is uninstalled.\n\n* The app connects the device to a different Wi-Fi network.\n\n* The user connects the device to a different Wi-Fi network.\n\n#### Errors:\n* `unavailableForOSVersion`: Starting from iOS 11, NEHotspotConfigurationError is available.\n* `invalid`: If an unknown error is occurred.\n* `invalidSSID`: If the SSID is invalid.\n* `invalidSSIDPrefix`: If the SSID prefix is invalid.\n* `invalidPassphrase`: If the passphrase is invalid.\n* `userDenied`: If the user canceled the request to join the asked network.\n* `locationPermissionDenied`: Starting from iOS 13, location permission is denied.\n* `locationPermissionRestricted`: Starting from iOS 13, location permission is restricted.\n* `couldNotDetectSSID`: If the SSID couldn't be detected.\n* `unableToConnect`: When an unknown error occurred.\n\n## Methods supported by 🟢Android ONLY\nThe following methods work only on Android\n\n### `loadWifiList(): Promise<Array<WifiEntry>>`\n\nReturns a list of nearby WiFI networks.\n* `SSID`: The network name.\n* `BSSID`: The WiFi BSSID.\n* `capabilities`: Describes the authentication, key management, and encryption schemes supported by the access point.\n* `frequency`: The primary 20 MHz frequency (in MHz) of the channel over which the client is communicating with the access point.\n* `level`: The detected signal level in dBm, also known as the RSSI.\n* `timestamp`: timestamp in microseconds (since boot) when this result was last seen.\n\n#### Errors:\n* `locationPermissionMissing`: Starting android 6, location permission needs to be granted for wifi \n* `locationServicesOff`: Starting Android 6, location services needs to be on to scan for wifi networks.\n* `exception`: Any other caught exception.\n\n### `reScanAndLoadWifiList(): Promise<Array<WifiEntry>>`\nSimilar to `loadWifiList` but it forcefully starts a new WiFi scan and only passes the results when the scan is done.\n\n### `isEnabled(): Promise<boolean>`\nMethod to check if WiFi is enabled.\n\n```javascript\nconst enabled = await WifiManager.isEnabled();\nthis.setState({wifiIsEnabled: enabled});\n```\n\n### `setEnabled(enabled: boolean)`\n\nMethod to set the WiFi on or off on the user's device.\n\n```javascript\nWifiManager.setEnabled(true); //set WiFi ON\nWifiManager.setEnabled(false); //set WiFi OFF\n```\n\n### `connectionStatus(): Promise<boolean>`\n\nReturns if the device is currently connected to a WiFi network.\n\n### `disconnect()`\nDisconnect currently connected WiFi network.\n\n### `getBSSID(): Promise<string>`\nReturns the BSSID (basic service set identifier) of the currently connected WiFi network.\n\n### `getCurrentSignalStrength(): Promise<number>`\nReturns the RSSI (received signal strength indicator) of the currently connected WiFi network.\n\n\n### `getFrequency(): Promise<number>`\nReturns the frequency of the currently connected WiFi network.\n\n### `getIP(): Promise<number>`\nReturns the IP of the currently connected WiFi network.\n\n### `isRemoveWifiNetwork(ssid: String): Promise<boolean>`\nThis method will remove the wifi network configuration.\nIf you are connected to that network, it will disconnect.\n\n#### Errors:\n* `locationPermissionMissing`: Starting android 6, location permission needs to be granted for wifi \n\n### `forceWifiUsage(useWifi: boolean): Promise<void>`\nDeprecated; see forceWifiUsageWithOptions.\n\n### `forceWifiUsageWithOptions(useWifi: boolean, options<Record<string, unknown>): Promise<void>`\n\nUse this to execute api calls to a wifi network that does not have internet access.\nUseful for commissioning IoT devices.\nThis will route all app network requests to the network (instead of the mobile connection).\nIt is important to disable it again after using as even when the app disconnects from the wifi network it will keep on routing everything to wifi.\n\n#### options\n* `noInternet: Boolean`: Indicate the wifi network does not have internet connectivity.\n\n## Conventions\n\n* Angular JS Git Commit conventions are used, [read more](https://gist.github.com/stephenparish/9941e89d80e2bc58a153#recognizing-unimportant-commits)\n","readmeFilename":"README.md","_rev":"1-6eb6fe718a3e66c09e5f5896e7129e8b"}