findAndConnect not working properly on Android 8.0
Sebastien-Lampazona opened this issue · 8 comments
Hello, i have tested on LG G6 on android 8.0, a Sony on android 8.0 and Asus zenpad on 7.0.
On the zenpad all working
On the LG and Sony, all working, but not the findAndConnect. The wifi network disconnect from the current network, and ( i have debug java ), the function connectTo return true, but the wifi dont connect to wanted network, and reconnect to previous network ...
I've test on an Open network, and a secure network, with and wihout internet on both
This seem arrive only on android 8.0, i can't find a fix ... An idea ?
This also doesn't work on my Galaxy S8 running android 8.0. findAndConnect returns false for found. Any help?
after many test i have seen that its because the networks was configured from another app, try to forgot the network and retry, normally it's working, i've modified java code in consequences
I tried using isRemoveWifiNetwork
to forget the network first, but that didn't help either. Even with a brand new network visible, it can't connect. Am I missing a permission or some other step?
No, you can't update, remove or create a wifi network that has already been configured by another app or by settings page of your phone.
The findAndConnect, try to update everytime network config if already exist, and return an error if it couldn't.
You must forget network from your phone settings and not from code before trying to connect from code.
For example, if you have an error of connection, write into a TextView at the user intention, asking him to forget the network himself and retry.
For permission you need one of them : ACCESS_COARSE_LOCATION or ACCESS_FINE_LOCATION
Another fix, try to remove double quote from ssid in the java code in version 8.0 of android
I hope i have helped you
I tried with adding double qoutes for android version 8 and it worked.
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { conf.SSID = "\"" + ssid + "\""; }
I opened a PR (#51) adding back double quote for SDK 26 and a change in behaviour to use phone stored config if exists. That eliminates the need for user to forget the network manually.
in android version <8 works fine. but in the latest versions 9, 10. it's not working.
Any solution?
Did anyone find a solution for verions of android >8?