Package android.net

Class ConnectivityManager.NetworkCallback

  • Enclosing class:
    ConnectivityManager

    public static class ConnectivityManager.NetworkCallback
    extends java.lang.Object
    Base class for NetworkRequest callbacks. Used for notifications about network changes. Should be extended by applications wanting notifications.
    • Constructor Summary

      Constructors 
      Constructor Description
      NetworkCallback()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void onAvailable​(Network network)
      Called when the framework connects and has declared new network ready for use.
      void onCapabilitiesChanged​(Network network, NetworkCapabilities networkCapabilities)
      Called when the network the framework connected to for this request changes capabilities but still satisfies the stated need.
      void onLost​(Network network)
      Called when the framework has a hard loss of the network or when the graceful failure ends.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NetworkCallback

        public NetworkCallback()
    • Method Detail

      • onAvailable

        public void onAvailable​(Network network)
        Called when the framework connects and has declared new network ready for use. This callback may be called more than once if the Network that is satisfying the request changes.
        Parameters:
        network - The Network of the satisfying network.
      • onCapabilitiesChanged

        public void onCapabilitiesChanged​(Network network,
                                          NetworkCapabilities networkCapabilities)
        Called when the network the framework connected to for this request changes capabilities but still satisfies the stated need.
        Parameters:
        network - The Network of the satisfying network.
        networkCapabilities - NetworkCapabilities: The new NetworkCapabilities for this network.
      • onLost

        public void onLost​(Network network)
        Called when the framework has a hard loss of the network or when the graceful failure ends.
        Parameters:
        network - The Network lost.