Monday, 4 July 2022

Two instances of the same network when searching wifi network

I am trying to connect to a device via wifi

final WifiNetworkSpecifier wifiNetworkSpecifier = new WifiNetworkSpecifier.Builder()
                .setSsidPattern(new PatternMatcher(networkSSIDPattern, PatternMatcher.PATTERN_PREFIX))
                .setWpa2Passphrase(passWord)
                .build();


final NetworkRequest networkRequest = new NetworkRequest.Builder()
                .addTransportType(NetworkCapabilities.TRANSPORT_WIFI)
                .removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)
                .setNetworkSpecifier(wifiNetworkSpecifier)
                .build();


connectivityManager = (ConnectivityManager) RainBird.getContext().getApplicationContext().getSystemService(CONNECTIVITY_SERVICE);

connectivityManager.requestNetwork(networkRequest, networkCallback);

I am getting a dialog with the good device network, after connecting, the same network appears two times in the dialog.

how can I fix it?

First connection view: enter image description here

after one connection, the same network appears 2 times: enter image description here

The problem only occurs on android12



from Two instances of the same network when searching wifi network

No comments:

Post a Comment