WifiManager.ConnectionInfo Property
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Return dynamic information about the current Wi-Fi connection, if any is active.
public virtual Android.Net.Wifi.WifiInfo? ConnectionInfo { [Android.Runtime.Register("getConnectionInfo", "()Landroid/net/wifi/WifiInfo;", "GetGetConnectionInfoHandler")] get; }
[<get: Android.Runtime.Register("getConnectionInfo", "()Landroid/net/wifi/WifiInfo;", "GetGetConnectionInfoHandler")>]
member this.ConnectionInfo : Android.Net.Wifi.WifiInfo
Property Value
the Wi-Fi information, contained in WifiInfo
.
- Attributes
Remarks
Return dynamic information about the current Wi-Fi connection, if any is active.
This member is deprecated. Starting with Build.VERSION_CODES#S
, WifiInfo retrieval is moved to ConnectivityManager
API surface. WifiInfo is attached in NetworkCapabilities#getTransportInfo()
which is available via callback in NetworkCallback#onCapabilitiesChanged(Network, NetworkCapabilities)
or on-demand from ConnectivityManager#getNetworkCapabilities(Network)
.
</p> Usage example: <pre> final NetworkRequest request = new NetworkRequest.Builder() .addTransportType(NetworkCapabilities.TRANSPORT_WIFI) .build(); final ConnectivityManager connectivityManager = context.getSystemService(ConnectivityManager.class); final NetworkCallback networkCallback = new NetworkCallback() { ... @Override void onAvailable(Network network) {}
@Override void onCapabilitiesChanged(Network network, NetworkCapabilities networkCapabilities) { WifiInfo wifiInfo = (WifiInfo) networkCapabilities.getTransportInfo(); } // etc. }; connectivityManager.requestNetwork(request, networkCallback); // For request connectivityManager.registerNetworkCallback(request, networkCallback); // For listen </pre> <p> <b>Compatibility Notes:</b> <li>Apps can continue using this API, however newer features such as ability to mask out location sensitive data in WifiInfo will not be supported via this API. </li> <li>On devices supporting concurrent connections (indicated via #isStaConcurrencyForLocalOnlyConnectionsSupported()
, etc) this API will return the details of the internet providing connection (if any) to all apps, except for the apps that triggered the creation of the concurrent connection. For such apps, this API will return the details of the connection they created. e.g. apps using WifiNetworkSpecifier
will trigger a concurrent connection on supported devices and hence this API will provide details of their peer to peer connection (not the internet providing connection). This is to maintain backwards compatibility with behavior on single STA devices.</li> </p>
Java documentation for android.net.wifi.WifiManager.getConnectionInfo()
.
Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.