Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

wifi.reScanAndLoadWifiList does not update on Android 8.0.0 #69

Open
JanisCGN opened this issue Dec 14, 2018 · 3 comments
Open

wifi.reScanAndLoadWifiList does not update on Android 8.0.0 #69

JanisCGN opened this issue Dec 14, 2018 · 3 comments

Comments

@JanisCGN
Copy link

Hi, I am trying to use reScanAndLoadWifiList on Android 8.0.0 .
React-Native version is 0.57.5 and the phone is Samsung Galaxy S7 edge.

I was hoping reScanAndLoadWifiList was going to refresh the list every time I called, but so far it behaves exactly like wifi.loadWifiList - it loads the wifilist once and then returns exactly the same list every time it is called again.

I am using your sample code with output via ToastAndroid on refresh of the screen.

wifi.reScanAndLoadWifiList((wifiStringList) => {
ToastAndroid.show(wifiStringList,ToastAndroid.SHORT);
var wifiArray = JSON.parse(wifiStringList);
console.log('Detected wifi networks - ',wifiArray);
},(error)=>{
console.log(error);
});

Regards

@bnchdrff
Copy link

this method uses the android method startScan which is marked as deprecated.

@bnchdrff
Copy link

bnchdrff commented Feb 21, 2019

could do something like this:

wifi.reScanAndLoadWifiList(
  wifis =>
    console.log(JSON.parse(wifis)),
  error =>
    console.error(error) ||
    wifi.loadWifiList(
      wifis =>
        console.log(JSON.parse(wifis)),
      error => console.error(error)
    )
);

@bnchdrff
Copy link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants