How to programmatically turn on and configure a hotspot in iOS? - ios

I realize the user can enable a hot spot, set the passkey and it will broadcast as their phones name, e.g Joe's iPhone
But is there away to turn on the hotspot programmatically in iOS and configure the ssid /wpa key?
For example I have another device searching for ssid mynetwork with password secret and I would like it to automatically connect to a hotspot my iOS app sets up without the user having to configure their hotspot manually

Currently No API available to create Hotspot.
You could Create new hotspot configurations for open, WEP, WPA/WPA2 personal, WPA/WPA enterprise, and Hotspot 2.0 Wi-Fi networks Using NEHotspotConfiguration Network Extension to connect to Wi-Fi networks.
init(ssid:passphrase:isWEP:)
Available iOS 11.0+

Related

Connect to an already remembered SSID in iOS through Xamarin

I am implementing an app through Xamarin.
Is it possible to programmatically connect to an SSID which is already remembered by the phone in iOS?
No, it is not possible to connect to a known network, without providing the necessary credentials, due to various security reasons.
In order to connect to a network, you need to create a NEHotspotConfiguration
The class requires either only SSID (for open networks), or SSID with some credentials for authentication.
After the configuration is created, you can connect via NEHotspotConfigurationManager like so:
await NEHotspotConfigurationManager.SharedManager.ApplyConfigurationAsync(config);
NB: Keep in mind that to connect to a network, you need to enable the Hotspot capability in your App Capabilities Working with capabilities.

iOS - How to send message from hotspot (iPhone) to connected client (IoT device)

I've searched google and only found the MultipeerConnectivity framework in iOS but I don't know how I could make it work for my specific case.
The flow of what I want to do is like this:
Enable personal hotspot in iOS
Connect to hotspot from a raspberry pie
Once client is connected, send a message string from the iOS app.
Assuming that the raspberry pie connection is already sorted out (We're using a static SSID and Password for the hotspot)
The questions that come up are:
Which framework should I use (assuming there is one already)?
do I need to explicitly advertise the iOS device from the app?
How do I get notified when the raspberry connects to the phone?
How do I send a message to the connected client?
Although I never developed anything for Pi, I developed net service browsing for iOS devices, so can give an answer.
When you connect to iPhone hotspot, it's a usual WiFi connection, so here you can use Bonjour protocol (mDNS) to discover devices one another.
Run Avahi mDNS service on Pi, and discover it on iPhone.
Here is how to run Avahi on Pi.
Here is how to discover mDNS net service on iPhone.
After net service is discovered with NSNetServiceBrowser, you'll have IP address and port of your Pi available on your iPhone, so you can connect to it.
If you are trying to setup a IoT system, it may be useful to look into various cloud offerings to facilitate messaging between devices. Personally I have used AWS IoT core services in the past, and it is relatively easy to setup messaging between devices.
I am not sure what your exact use case is for this setup, but using a cloud based service to setup messaging between devices will remove the requirement to connect directly between devices via hotspot (the pi still needs some internet connection), and could make it easier to enable multiple devices and app clients in the system.

Get list of all available Wifi Connections and choose one to connect inside an App in iOS 11

In iOS 11 Apple has added NEHotspotConfiguration and NEHotspotConfigurationManager
I am trying to build an app - where:
User opens the app
User scans for available Wifi networks
User selects to connect a network
Have tried below links:
https://developer.apple.com/documentation/networkextension/nehotspotconfiguration
https://developer.apple.com/documentation/networkextension/nehotspotconfigurationmanager
This is not possible on iOS. The API you have found is the most capable API for interacting with WiFi access points

How to scan all available wifi and connect with particular wifi

I want to get wifi's SSID and password from server and I have to check any available wifi's SSID is matched with my server's SSID. If any matched, I have to connect with that wifi using its password. I have read many post related to this but I couldn't get any answer.
This is not possible in iOS. The only thing you can retrieve is the SSID after the user has connected to one of the Wi-Fi networks using the regular iOS UI.
You can use Hotspot Configuration to register SSID/password to connect to.
For more info, see iOS - How to programmatically connect to a WiFi network given the SSID and Password using a private/3rd party library

Is there a way to Connect with a Wi-Fi Modem via my iOS app without using Settings Page?

I want to connect with a Wi-Fi Modem via my iOS app. I don't want the user to go to Settings page and Activate Wi-Fi. Is it possible to achieve a Single Button - Pressed & Wi-Fi Connection Activated?
Thanks for your reply!!!
This is not possible unless you use Apple80211 private API, which will be rejected from the App Store.
Here's more information on how it's not possible, and here's a framework for jailbroken phones to use private API and seek/connect to a network.

Resources