Programatically connecting to WiFi networks in React Native on iOS 11
Currently we are working on an Internet of Things (IoT) app for one of our clients. We are writing this app in React Native and need to connect to a hardware device via its own WiFi hotspot, to then set it up with the home WiFi network.
For Android, there are perfectly fine libraries to accomplish this. In iOS, for long it was not possible to do anything with WiFi apart from getting the SSID of the WiFi network the phone is currently connected to. You had to redirect users to the Settings app to connect the phone to the accessory’s WiFi hotspot.
Since iOS 11, with the help of NEHotspotConfigurationManager
, it is now possible to automatically join a WiFi network for these purposes.
Find below some snippets of how to access these methods from React Native!