'Hotspot helper swift
I'm using the hotspot helper to connect to an open network. I want to send an association event to the backend using the connection network. But the network is not yet available on the hotspot helper events. Is it possible to send a request using this network on authenticate or presentUI events? Backend is only accessible from an open Wi-Fi network. Thanks for answers!
static func handle(authenticate command: NEHotspotHelperCommand) {
guard let network = command.network else {
NSLog("<ERROR> No network provided for authenticate command: \(command)")
command.createResponse(.temporaryFailure).deliver()
return
}
NSLog("Authenticate network: \(network)")
//Here I want to send an association event
let content = UNMutableNotificationContent()
content.title = "Helper work"
content.body = "Status: Authenticate"
let request = UNNotificationRequest(identifier: "UIRequiredNotification", content: content, trigger: nil)
UNUserNotificationCenter.current().add(request) { error in
let result: NEHotspotHelperResult = (error != nil)
? .temporaryFailure
: .uiRequired
command.createResponse(result).deliver()
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
