Package org.robolectric.shadows
Class ShadowNetworkCapabilities
java.lang.Object
org.robolectric.shadows.ShadowNetworkCapabilities
@Implements(value=android.net.NetworkCapabilities.class, minSdk=21) public class ShadowNetworkCapabilities extends Object
Robolectic provides overrides for fetching and updating transport.
-
Field Summary
Fields Modifier and Type Field Description protected NetworkCapabilities
realNetworkCapabilities
-
Constructor Summary
Constructors Constructor Description ShadowNetworkCapabilities()
-
Method Summary
Modifier and Type Method Description NetworkCapabilities
addCapability(int capability)
Addscapability
to the NetworkCapabilities.NetworkCapabilities
addTransportType(int transportType)
Updates the transport types for this network capablities to includetransportType
.static NetworkCapabilities
newInstance()
NetworkCapabilities
removeCapability(int capability)
Removescapability
from the NetworkCapabilities.NetworkCapabilities
removeTransportType(int transportType)
Updates the transport types for this network capablities to removetransportType
.NetworkCapabilities
setLinkDownstreamBandwidthKbps(int kbps)
Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.NetworkCapabilities
setNetworkSpecifier(NetworkSpecifier networkSpecifier)
ChangesNetworkSpecifier
for this network capabilities.NetworkCapabilities
setNetworkSpecifier(String networkSpecifier)
ChangesNetworkSpecifier
for this network capabilities.NetworkCapabilities
setTransportInfo(TransportInfo transportInfo)
Sets thetransportInfo
of the NetworkCapabilities.
-
Field Details
-
Constructor Details
-
ShadowNetworkCapabilities
public ShadowNetworkCapabilities()
-
-
Method Details
-
newInstance
-
addTransportType
Updates the transport types for this network capablities to includetransportType
. -
removeTransportType
Updates the transport types for this network capablities to removetransportType
. -
addCapability
Addscapability
to the NetworkCapabilities. -
removeCapability
Removescapability
from the NetworkCapabilities. -
setNetworkSpecifier
@Implementation(minSdk=26) public NetworkCapabilities setNetworkSpecifier(NetworkSpecifier networkSpecifier)ChangesNetworkSpecifier
for this network capabilities. Works only on Android O and higher. For lower versions usesetNetworkSpecifier(String)
-
setNetworkSpecifier
@Implementation(minSdk=24, maxSdk=25) public NetworkCapabilities setNetworkSpecifier(String networkSpecifier)ChangesNetworkSpecifier
for this network capabilities. Works only on Android N_MR1 and lower. For higher versions usesetNetworkSpecifier(NetworkSpecifier)
-
setTransportInfo
@HiddenApi @Implementation(minSdk=29) public NetworkCapabilities setTransportInfo(TransportInfo transportInfo)Sets thetransportInfo
of the NetworkCapabilities. -
setLinkDownstreamBandwidthKbps
@HiddenApi @Implementation(minSdk=29) public NetworkCapabilities setLinkDownstreamBandwidthKbps(int kbps)Sets the LinkDownstreamBandwidthKbps of the NetworkCapabilities.
-