Open nikhilsmg opened 4 years ago
@nikhilsmg I don't know if you found an answer to your issue but I am using the library on android version greater than 8. I would guess that you need to enabled course location (or fine location) permission as I believe this requirement was added around version 8 and could be the reason you are unable to successfully connect.
A bit off topic, but API level 29 and above (android 10+) has deprecated a lot of the connection method used here. Any upcoming pull requests to fix that? https://developer.android.com/about/versions/10/privacy/changes#configure-wifi
the problematic code is in connectTo()
method from what I have noticed:
// If network not already in configured networks add new network
if ( updateNetwork == -1 ) {
updateNetwork = wifi.addNetwork(conf);
wifi.saveConfiguration();
}
// if network not added return false
// TODO: addNetwork() will always return -1 in API 29 and above
if ( updateNetwork == -1 ) {
return false;
}
// disconnect current network
// TODO: disconnect() will always return false in API 29 and above
boolean disconnect = wifi.disconnect();
if ( !disconnect ) {
return false;
}
// enable new network
// TODO: enableNetwork() will always return false in API 29 and above
boolean enableNetwork = wifi.enableNetwork(updateNetwork, true);
if ( !enableNetwork ) {
return false;
}
@nikhilsmg I don't know if you found an answer to your issue but I am using the library on android version greater than 8. I would guess that you need to enabled course location (or fine location) permission as I believe this requirement was added around version 8 and could be the reason you are unable to successfully connect.
For us, the feature broke on android 10+ phones after upgrading our app target sdk version from API Level 28 to 29, in compliance with Play Store. It still works on older android OS phones. We have always requested ACCESS_FINE_LOCATION permission, so it is not the issue.
Hi, anyone have a solution for this issue? I have the same problem in API 30, found always return false.
I'm also facing the same issue. It would be of great help if there was a solution to this
In android version <8 works fine. but in the latest versions 9, 10. it's not working. Any solution?