I defined the receiver in the Android Android app for the sandbox:
<receiver android:exported="true" android:name="com.sandboxapplication.NetworkReceiver"> <intent-filter> <action android:name="android.net.conn.CONNECTIVITY_CHANGE" /> </intent-filter> </receiver>
It is pretty simple:
public class NetworkReceiver extends BroadcastReceiver { private static final String TAG = NetworkReceiver.class.getName(); @Override public void onReceive(Context context, Intent intent) { Log.i(TAG, "Received Network Change event."); } }
This receiver works fine if my targetSdkVersion is 23 in my build.gradle file. However, if I set myTestVVersion to 24, the receiver will never receive anything. In fact, if I put a debug breakpoint in my receiver, Android Studio gives me a visual indication that it looks like the class never loads into memory.
Am I missing something very simple in the Android N documentation? Is there a new way to detect communication change events?
android android-7.0-nougat
DanMD Aug 22 '16 at 10:16 2016-08-22 10:16
source share