Skip to content
SFKiller edited this page Oct 26, 2015 · 4 revisions

Welcome to the NetworkStateMonitor wiki!

Usage:

1、Copy java files, in src folder, to your project;

2、In your AndroidManifest.xml:

    <uses-permission android:name="android.permission.ACCESS_NETWORK_STATE"/>

    ......

    <receiver android:name="you.package.name.NetworkStateReceiver">"
        <intent-filter>
            <action android:name="android.net.conn.CONNECTIVITY_CHANGE" />
        </intent-filter>
    </receiver>

3、Where you want to monitor network state, like an activity, just do like this:

    NetworkStateReceiver.handlerList.add(context);

Clone this wiki locally