Search code examples
androidbroadcastreceiverandroid-networking

Broadcast reveiver for detecting availability of a new network


I am looking to find an intent action that is fired when a new network is detected on your android phone. Is thea any? I have checked the documentation, the only one that is close is android.net.conn.CONNECTIVITY_CHANGE I want to write a Broadcast receiver that listens to a new network detected. Alternatively is there like volatile a content provider for the networks your android phone detects? Thanx


Solution

  • Do you want to be informed when your Android device connects to a new network? In that case you need to use NETWORK_STATE_CHANGED_ACTION. This question at SO deals with something similar (specific to WiFi though). You might find something similar to deal with a higher abstraction (i.e, Network in place of Wifi).

    If you want to be informed when a new network (i.e, AP) is visible to your Android device, try looking at WifiManager.SCAN_RESULTS_AVAILABLE_ACTION.