ConnectivityManagerCompat

public final class ConnectivityManagerCompat


Helper for accessing features in ConnectivityManager.

Summary

Constants

static final int

Device is not restricting metered network activity while application is running on background.

static final int

Device is restricting metered network activity while application is running on background.

static final int

Device is restricting metered network activity while application is running on background, but application is allowed to bypass it.

Public constructors

Public methods

static @Nullable @RequiresPermission(value = android.Manifest.permission.ACCESS_NETWORK_STATE) NetworkInfo

Return the NetworkInfo that caused the given CONNECTIVITY_ACTION broadcast.

static @ConnectivityManagerCompat.RestrictBackgroundStatus int

Determines if the calling application is subject to metered network restrictions while running on background.

static @RequiresPermission(value = android.Manifest.permission.ACCESS_NETWORK_STATE) boolean

Returns if the currently active data network is metered.

Constants

RESTRICT_BACKGROUND_STATUS_DISABLED

public static final int RESTRICT_BACKGROUND_STATUS_DISABLED

Device is not restricting metered network activity while application is running on background.

RESTRICT_BACKGROUND_STATUS_ENABLED

public static final int RESTRICT_BACKGROUND_STATUS_ENABLED

Device is restricting metered network activity while application is running on background.

In this state, application should not try to use the network while running on background, because it would be denied.

RESTRICT_BACKGROUND_STATUS_WHITELISTED

public static final int RESTRICT_BACKGROUND_STATUS_WHITELISTED

Device is restricting metered network activity while application is running on background, but application is allowed to bypass it.

In this state, application should take action to mitigate metered network access. For example, a music streaming application should switch to a low-bandwidth bitrate.

Public constructors

ConnectivityManagerCompat

public final ConnectivityManagerCompat()

Public methods