0

I am trying to figure out changed wifi connection while in the background. I want to make sure if my current wifi is same as previously connected wifi no action is taken while if its a new wifi that gets configured then I want my code to trigger. Any way we can check this currently ? would introduce a boolean var for checking wifi/network change.

  • How would you define a "changed wifi connection"? If the IP changes? If you've connected to a different AP, on the same network? – Jonathan Hall Sep 12 '18 at 10:43
  • For instance, I am on one wifi when my app is in the foreground, then my wifi switches to some other wifi while in the background then I want to be able to say my network/wifi changed. If the wifi does not change when I return to the foreground from background I dont want the wifi connected param to trigger.Currently I have registered a receiver in my activity which triggers wifi connected state everytime I return to foreground from background even if nothing was changed –  Sep 12 '18 at 10:57
  • I understand. My question is: What, to you, constitutes a change of wifi? You could get an new IP address, while remaining connected to the same wifi connection (if DHCP expires). Does that count as a change? Or you could retain the same IP, but connect to a different access point, if you're on a large mesh network. Does that count as a change to you? You could also disconnect and re-connect to the same wifi. Does that count as a change to you? What if you connect to the same AP with the same IP, but renegotiate a different wifi protocol (e.g. from 802.11g to a/b). Is that a change? – Jonathan Hall Sep 12 '18 at 10:58

0 Answers0