Added in API level 1

android.net


Classes that help with network access, beyond the normal java.net.* APIs.

Interfaces

ConnectivityManager.OnNetworkActiveListener Callback for use with ConnectivityManager#addDefaultNetworkActiveListener to find out when the system default network has gone in to a high power state. 
DnsResolver.Callback<T> Base interface for answer callbacks 
TransportInfo A container for transport-specific capabilities which is returned by NetworkCapabilities#getTransportInfo()
UrlQuerySanitizer.ValueSanitizer A functor used to sanitize a single query value. 

Classes

CaptivePortal A class allowing apps handling the ConnectivityManager#ACTION_CAPTIVE_PORTAL_SIGN_IN activity to indicate to the system different outcomes of captive portal sign in. 
ConnectivityDiagnosticsManager Class that provides utilities for collecting network connectivity diagnostics information. 
ConnectivityDiagnosticsManager.ConnectivityDiagnosticsCallback Abstract base class for Connectivity Diagnostics callbacks. 
ConnectivityDiagnosticsManager.ConnectivityReport Class that includes connectivity information for a specific Network at a specific time. 
ConnectivityDiagnosticsManager.DataStallReport Class that includes information for a suspected data stall on a specific Network 
ConnectivityManager Class that answers queries about the state of network connectivity. 
ConnectivityManager.NetworkCallback Base class for NetworkRequest callbacks. 
Credentials A class for representing UNIX credentials passed via ancillary data on UNIX domain sockets. 
DhcpInfo A simple object for retrieving the results of a DHCP request. 
DnsResolver Dns resolver class for asynchronous dns querying Note that if a client sends a query with more than 1 record in the question section but the remote dns server does not support this, it may not respond at all, leading to a timeout. 
EthernetNetworkSpecifier A NetworkSpecifier used to identify ethernet interfaces. 
Ikev2VpnProfile The Ikev2VpnProfile is a configuration for the platform setup of IKEv2/IPsec VPNs. 
Ikev2VpnProfile.Builder A incremental builder for IKEv2 VPN profiles 
InetAddresses Utility methods for InetAddress implementations. 
IpConfiguration A class representing the IP configuration of a network. 
IpConfiguration.Builder Builder used to construct IpConfiguration objects. 
IpPrefix This class represents an IP prefix, i.e., a contiguous block of IP addresses aligned on a power of two boundary (also known as an "IP subnet"). 
IpSecAlgorithm This class represents a single algorithm that can be used by an IpSecTransform
IpSecManager This class contains methods for managing IPsec sessions. 
IpSecManager.SecurityParameterIndex This class represents a reserved SPI. 
IpSecManager.UdpEncapsulationSocket This class provides access to a UDP encapsulation Socket. 
IpSecTransform This class represents a transform, which roughly corresponds to an IPsec Security Association. 
IpSecTransform.Builder This class is used to build IpSecTransform objects. 
IpSecTransformState This class represents a snapshot of the state of an IpSecTransform

This class provides the current state of an IpSecTransform, enabling link metric analysis by the caller. 

IpSecTransformState.Builder Builder class for testing purposes

Except for testing, IPsec callers normally do not instantiate IpSecTransformState themselves but instead get a reference via IpSecTransformState 

LinkAddress Identifies an IP address on a network link. 
LinkProperties Describes the properties of a network link. 
LocalServerSocket Non-standard class for creating an inbound UNIX-domain socket in the Linux abstract namespace. 
LocalSocket Creates a (non-server) socket in the UNIX-domain namespace. 
LocalSocketAddress A UNIX-domain (AF_LOCAL) socket address. 
MacAddress Representation of a MAC address. 
MailTo MailTo URL parser This class parses a mailto scheme URL and then can be queried for the parsed parameters. 
Network Identifies a Network
NetworkCapabilities Representation of the capabilities of an active network. 
NetworkInfo This class was deprecated in API level 29. Callers should instead use the ConnectivityManager.NetworkCallback API to learn about connectivity changes, or switch to use ConnectivityManager#getNetworkCapabilities or ConnectivityManager#getLinkProperties to get information synchronously. Keep in mind that while callbacks are guaranteed to be called for every event in order, synchronous calls have no such constraints, and as such it is unadvisable to use the synchronous methods inside the callbacks as they will often not offer a view of networking that is consistent (that is: they may return a past or a future state with respect to the event being processed by the callback). Instead, callers are advised to only use the arguments of the callbacks, possibly memorizing the specific bits of information they need to keep from one callback to another. 
NetworkRequest An object describing a network that the application is interested in. 
NetworkRequest.Builder Builder used to create NetworkRequest objects. 
NetworkSpecifier Describes specific properties of a requested network for use in a NetworkRequest
PlatformVpnProfile PlatformVpnProfile represents a configuration for a platform-based VPN implementation. 
Proxy A convenience class for accessing the user and default proxy settings. 
ProxyInfo Describes a proxy configuration. 
RouteInfo Represents a network route. 
SocketKeepalive Allows applications to request that the system periodically send specific packets on their behalf, using hardware offload to save battery power. 
SocketKeepalive.Callback The callback which app can use to learn the status changes of SocketKeepalive
SSLCertificateSocketFactory This class was deprecated in API level 29. This class has less error-prone replacements using standard APIs. To create an SSLSocket, obtain an SSLSocketFactory from SSLSocketFactory#getDefault() or SSLContext.getSocketFactory(). To verify hostnames, pass "HTTPS" to SSLParameters.setEndpointIdentificationAlgorithm(String). To enable ALPN, use SSLParameters.setApplicationProtocols(String[]). To enable SNI, use SSLParameters.setServerNames(java.util.List). 
SSLSessionCache File-based cache of established SSL sessions. 
StaticIpConfiguration Class that describes static IP configuration. 
StaticIpConfiguration.Builder Helper class to build a new instance of StaticIpConfiguration
TelephonyNetworkSpecifier NetworkSpecifier object for cellular network request. 
TelephonyNetworkSpecifier.Builder Builder to create TelephonyNetworkSpecifier object. 
TrafficStats Class that provides network traffic statistics. 
Uri Immutable URI reference. 
Uri.Builder Helper class for building or manipulating URI references. 
UrlQuerySanitizer Sanitizes the Query portion of a URL. 
UrlQuerySanitizer.IllegalCharacterValueSanitizer Sanitize values based on which characters they contain. 
UrlQuerySanitizer.ParameterValuePair A simple tuple that holds parameter-value pairs. 
VpnManager This class provides an interface for apps to manage platform VPN profiles

Apps can use this API to provide profiles with which the platform can set up a VPN without further app intermediation. 

VpnProfileState Describe the state of VPN. 
VpnService VpnService is a base class for applications to extend and build their own VPN solutions. 
VpnService.Builder Helper class to create a VPN interface. 

Enums

LocalSocketAddress.Namespace The namespace that this address exists in. 
NetworkInfo.DetailedState This enum was deprecated in API level 29. See NetworkInfo. 
NetworkInfo.State This enum was deprecated in API level 29. See NetworkInfo. 

Exceptions

DnsResolver.DnsException Class to represent DNS error 
IpSecManager.ResourceUnavailableException Thrown to indicate that an IPsec resource is unavailable. 
IpSecManager.SpiUnavailableException Thrown to indicate that a requested SPI is in use. 
ParseException Thrown when parsing failed.