0

Is there a way to display all Wifi list in react native using expo for Android. I have seen a few libraries but mostly for android and even those don't work properly. Any suggestions?

I want like :

enter image description here

Aniruddha Mishra
  • 661
  • 2
  • 11
  • 25
  • I think it's not possible with Expo, it's a feature not available now: check the answer in the forum: https://forums.expo.io/t/is-there-any-way-to-get-ssid-in-expo/1199/2 – Rebai Ahmed Nov 25 '19 at 14:35

2 Answers2

0

use this library and this the code give you (SSID) list

getWifiNetworksOnPress(){
wifi.loadWifiList((wifiStringList) => {
    console.log(wifiStringList);
    var wifiArray = JSON.parse(wifiStringList);
   console.log(wifiArray);
  },
  (error) => {
    console.log(error);
  }
);

}

but in Android Api >25 you must be granted the ACCESS_COARSE_LOCATION (or ACCESS_FINE_LOCATION) permission in order to obtain results.

0

Just visit react-native-wifi-reborn.

Usage

import WifiManager from "react-native-wifi-reborn";

WifiManager.connectToProtectedSSID(ssid, password, isWep).then(
   () => {
     console.log("Connected successfully!");
   },
   () => {
     console.log("Connection failed!");
   }
 );

 WifiManager.getCurrentWifiSSID().then(
   ssid => {
     console.log("Your current connected wifi SSID is " + ssid);
   },
   () => {
     console.log("Cannot get current SSID!");
   }
 );

I hope it will work.

burrito
  • 143
  • 1
  • 2
  • 11
Talha Akbar
  • 462
  • 3
  • 15