com.unclouded.android
Class NetworkListener

java.lang.Object
  extended by com.unclouded.android.NetworkListener

public class NetworkListener
extends Object

Monitors the state of the established network connection. A NetworkListener instance is triggered in four cases:

Note that all four methods are optional and not required to be implemented.


Constructor Summary
NetworkListener()
           
 
Method Summary
 void isConnectedTo(InetAddress ipAddress)
          Triggered after establishing a connection to a device in the network.
 void isDisconnectedFrom(InetAddress ipAddress)
          Triggered after a disconnection of a device in the network.
 void isOffline(InetAddress ipAddress)
          Triggered after the device is offline.
 void isOnline(InetAddress ipAddress)
          Triggered after the device is online.
 String toString()
          Returns a string representation of a NetworkListener object.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

NetworkListener

public NetworkListener()
Method Detail

isOnline

public void isOnline(InetAddress ipAddress)
Triggered after the device is online. The device is now connected to the network and can be discovered by other devices.

Parameters:
ipAddress - the address that was obtained upon connecting to the network.

isOffline

public void isOffline(InetAddress ipAddress)
Triggered after the device is offline. The device is now disconnected from the network and cannot be discovered by other devices, nor interact with them.

Parameters:
ipAddress - the address that was obtained when the device was online.

isConnectedTo

public void isConnectedTo(InetAddress ipAddress)
Triggered after establishing a connection to a device in the network.

Parameters:
ipAddress - the address of the devices wherewith a connection is established.

isDisconnectedFrom

public void isDisconnectedFrom(InetAddress ipAddress)
Triggered after a disconnection of a device in the network.

Parameters:
ipAddress - the address of the device that disconnected from the network.

toString

public String toString()
Returns a string representation of a NetworkListener object.

Overrides:
toString in class Object
Returns:
a string representation of the network listener.