addListener

Adds the specified listener to the list of listeners that will be notified when the host device's network connectivity state changes. Please call removeListener to free up resources.

Please note that the design of the connectivity monitor intentionally discourages the practice of using anonymous objects as listeners to avoid resource leaks. The listener will be held weakly by this class. Anonymous listeners may get collected by GC immediately.

Return

reference to the single instance of ConnectivityMonitor

Parameters

listener

reference to the listener.