Is it possible to detect new Wi-Fi connections in iOS when app is in Background

HI!


I need to create LocalNotifications when user connects to new Wi-Fi connections SSID, to notice the user to connect to VPN for security reasons.


After some research i can't find nothing about this for iOS 12, but i saw this in App in Apple Store that makes just the described behaviour:


https://itunes.apple.com/us/app/wi-fi-login/id1372426307?mt=8


This is a excerpt of description of this App:


"In addition, on supported "captive" Wi-Fi networks, the app will notify you in the background (even when your device is locked) if that network is impeding your device's internet access."


I tried things like Reachavility swift class: https://github.com/ashleymills/Reachability.swift but this solutions only work when app is on Foreground.


Please, someone know about this?


Thanks in advance!

Replies

Is it possible to detect new Wi-Fi connections in iOS when app is in Background

Not directly.

I need to create LocalNotifications when user connects to new Wi-Fi connections SSID, to notice the user to connect to VPN for security reasons.

I can see a couple of possible directions you might take here:

  • VPN On Demand — This lets you set up various criteria under which the VPN will automatically connect. If you implement a custom VPN transport then it could post a notification when that connection fails.

    See the VPN On Demand section of the iOS Deployment Reference for more on how this works.

  • NEHotspotHelper
    — Hotspot helper allows your app to get involved in the hotspot login process. See the docs for more.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"