• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Android Q WEP connection

GreeshmaS

Lurker
I'm trying to connect to a WEP network using the latest Android Q Beta 4. The old style off communicating was quite straight forward. Using something like:

Java:
WifiConfiguration connection = createApConfiguration(ssid, password, "WEP");

int res = wifiManager.addNetwork(connection);

However in the Q release this has been deprecated. https://developer.android.com/refer...ddNetwork(android.net.wifi.WifiConfiguration)

I need to connect to a "WEP" network and I don’t see any option to set such configuration. The latest API im using is below.


Java:
val specifier = WifiNetworkSpecifier.Builder()

.setSsid("NetworkID")

.setIsHiddenSsid(false)

.setIsEnhancedOpen(false)

.setBssidPattern(MacAddress.fromString("10:03:23:00:00:00"), MacAddress.fromString("ff:ff:ff:00:00:00"))

.build()


val request = NetworkRequest.Builder()

.addTransportType(NetworkCapabilities.TRANSPORT_WIFI)

.removeCapability(NetworkCapabilities.NET_CAPABILITY_INTERNET)

.setNetworkSpecifier(specifier)

.build()


val connectivityManager = this.getSystemService(Context.CONNECTIVITY_SERVICE) as ConnectivityManager


val networkCallback = object : ConnectivityManager.NetworkCallback() {


override fun onAvailable(network: Network?) {

Log.d("AVAILABLE", "onAvailable")

}


override fun onUnavailable() {

Log.d("UNAVAILABLE", "onUnavailable")

}}


connectivityManager.requestNetwork(request, networkCallback)



Any help would be very much appreciated

Thanks in advance
 
Have you tried WifiNetworkSpecifier.Builder, as it suggests in the Javadocs:

This method was deprecated in API level 29.
a) See WifiNetworkSpecifier.Builder#build() for new mechanism to trigger connection to a Wi-Fi network. b) See addNetworkSuggestions(java.util.List), removeNetworkSuggestions(java.util.List) for new API to add Wi-Fi networks for consideration when auto-connecting to wifi. Compatibility Note: For applications targetingBuild.VERSION_CODES.Q or above, this API will always return -1.
 
Perhaps WEP support has finally been removed from the Q versions of Android now.

WEP has actually been deprecated as insecure by the WiFi Alliance since 2004. And quite frankly nobody should be using WEP, now, well not if data security and privacy are important.
 
Back
Top Bottom