public void changeToWifiQ (Context Context, final String wifiName, String wifiPwd) {
If (Build) VERSION) SDK_INT & gt;=Build. VERSION_CODES. Q) {
NetworkSpecifier specifiers=
New WifiNetworkSpecifier. Builder ()
SetSsidPattern (new PatternMatcher (wifiName, PatternMatcher PATTERN_PREFIX))
. SetWpa2Passphrase (wifiPwd)
.build();
NetworkRequest request=
New NetworkRequest. Builder ()
AddTransportType (NetworkCapabilities. TRANSPORT_WIFI)
_CAPABILITY_INTERNET removeCapability (NetworkCapabilities.NET)
. SetNetworkSpecifier (specifiers)
.build();
ConnectivityManager ConnectivityManager=(ConnectivityManager)
The context. GetSystemService (context. CONNECTIVITY_SERVICE);
ConnectivityManager.Net workCallback networkCallback=new ConnectivityManager.Net workCallback () {
@ Override
Public void onAvailable Network (Network) {
//do success processing here..
}
@ Override
Public void onUnavailable () {
//do failure processing here..
}
};
ConnectivityManager. RequestNetwork (request, networkCallback);
}
}
use the above code in huawei mobile phone connection above will repeat the popup window