I'm trying to make broadcast receiver that listen to internet connectivity and then do some tasks when connected.
I do not receive any notification when I disable or enable my WIFI on my real device or disable/enable the data access in emulator. the action CONNECTIVITY_CHANGE is no longer supported.
public class InternetConnectivityReceiver extends BroadcastReceiver {
Context context;
@Override
public void onReceive(Context context, Intent intent) {
this.context = context;
Log.i(TAG, "Internet Conenction State Changed");
}
}
Manifest
<application
android:icon="@android:drawable/arrow_down_float"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<receiver android:name=".InternetConnectivityReceiver">
<intent-filter>
<action android:name="android.net.conn.BACKGROUND_DATA_SETTING_CHANGED">
</action>
</intent-filter>
</receiver>
......
</application>