I\'m attempting several methods trying to enable/disable Wi-Fi (toggle). Here are some things I am trying:
//Enable
WiFiManagerClientEnable(WiFiManagerClient
notify_post("com.yourcompany.yourapp.yournotification");
#import <SpringBoard/SBWiFiManager.h>
HOOK(SpringBoard, applicationDidFinishLaunching$, void, id app) {
//Listen for events via DARWIN NOTIFICATION CENTER
CFNotificationCenterAddObserver(CFNotificationCenterGetDarwinNotifyCenter(), NULL,
&NotificationReceivedCallback, CFSTR("com.yourcompany.yourapp.yournotification"), NULL,
CFNotificationSuspensionBehaviorCoalesce);
}
//THIS IS WHERE THE MAGIC HAPPENS
static void NotificationReceivedCallback(CFNotificationCenterRef center,
void *observer, CFStringRef name,
const void *object, CFDictionaryRef
userInfo)
{
[[objc_getClass("SBWiFiManager") sharedInstance] setWiFiEnabled:NO];
}
You cannot disable WiFi on the phone. The user is responsible for this action through the Settings App, this capability is not available through the SDK.
-t