android.support.v4.net
Class ConnectivityManagerCompat
java.lang.Object
android.support.v4.net.ConnectivityManagerCompat
public class ConnectivityManagerCompat
- extends Object
Helper for accessing features in ConnectivityManager
introduced after
API level 16 in a backwards compatible fashion.
Method Summary |
static android.net.NetworkInfo |
getNetworkInfoFromBroadcast(android.net.ConnectivityManager cm,
android.content.Intent intent)
Return the NetworkInfo that caused the given
ConnectivityManager.CONNECTIVITY_ACTION broadcast. |
static boolean |
isActiveNetworkMetered(android.net.ConnectivityManager cm)
Returns if the currently active data network is metered. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
ConnectivityManagerCompat
public ConnectivityManagerCompat()
isActiveNetworkMetered
public static boolean isActiveNetworkMetered(android.net.ConnectivityManager cm)
- Returns if the currently active data network is metered. A network is
classified as metered when the user is sensitive to heavy data usage on
that connection. You should check this before doing large data transfers,
and warn the user or delay the operation until another network is
available.
getNetworkInfoFromBroadcast
public static android.net.NetworkInfo getNetworkInfoFromBroadcast(android.net.ConnectivityManager cm,
android.content.Intent intent)
- Return the
NetworkInfo
that caused the given
ConnectivityManager.CONNECTIVITY_ACTION
broadcast. This obtains
the current state from ConnectivityManager
instead of using the
potentially-stale value from
ConnectivityManager.EXTRA_NETWORK_INFO
.
Copyright © 2013 Marek Kedzierski. All Rights Reserved.