title: Detect CONNECTIVITY CHANGE in Android 7 and above when app is killed/in background
body: <p><strong>Problem:</strong></p>
  
  <p>So the problem is that I have an app which sends a request to our backend whenever WiFi is connected (with the connected SSID and other info) or when it is disconnected (over the mobile network). However with the changes in Android 7/N and above, CONNECTIVITY_CHANGE and CONNECTIVITY_ACTION no longer work in the background. Now in most cases people misuse this broadcast and as such I can completely understand why the change was made. However, I have no idea how to solve this problem in the current state.</p>
  
  <p>Now I'm not at all much of an Android developer (this is for a Cordova plugin) so I'm counting on you guys!</p>
  
  <p><strong>Expected behavior:</strong>
  App is woken up and request is sent whenever WiFi switches connectivity, even when app is killed/in background.</p>
  
  <p><strong>Current behavior:</strong>
  App only sends request when the app is in the foreground.</p>
  
  <p><strong>Tried so far:</strong>
  So far I've moved the implicit intent to listen to CONNECTIVITY_ACTION from the manifest to manually registering it in the main part of the app (plugin). This makes it work as long as the app is in memory but not on cold boot or actual background</p>
  
  <p><strong>Already looked at:</strong>
  Most answers talk about using scheduled jobs to substitute for the missing broadcast. I see how this works for, for example, retrying a download or similar, but not for my case (but please correct me if I'm wrong). Below are the SO posts I've already looked at:</p>
  
  <p><a href="https://stackoverflow.com/questions/39210191/detect-connectivity-changes-on-android-7-0-nougat-when-app-is-in-foreground">Detect connectivity changes on Android 7.0 Nougat when app is in foreground</a></p>
  
  <p><a href="https://stackoverflow.com/questions/36421930/connectivitymanager-connectivity-action-deprecated">ConnectivityManager.CONNECTIVITY_ACTION deprecated</a></p>
  
  <p><a href="https://stackoverflow.com/questions/45430598/detect-connectivity-change-using-jobscheduler">Detect Connectivity change using JobScheduler</a></p>
  
  <p><a href="https://stackoverflow.com/questions/46163131/android-o-detect-connectivity-change-in-background">Android O - Detect connectivity change in background</a></p>