Howto Access WiFi Settings programmatically in iOS 5.1 - wifi

I'm looking for a smart way letting the user of my app connect to a WiFi Network. I know how to detect if the device is connected or not. I tried to use URL's to direct the User to the correct prefs Page. Unfortunately this doesn't work anymore. Any suggestions on howto require users to connect to WiFi???
thanks for helping!!!

Try using it to access the WiFi settings in iOS 5.1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
Try using it to access the WiFi settings in iOS 9
if (&UIApplicationOpenSettingsURLString != NULL) {
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
}
Try to add prefs tu URL schemes like stackoverflow.com/a/31253743/3668465 did.
You can use this option for identify a SSID:
iOS >= 4.1 it's possible to obtain SSID of wireless network that device is currenctly connected to.
For this you'd use function CNCopyCurrentNetworkInfo
Details on implemenation: iPhone get SSID without private library
question example -> how to programmatically open the WIFI settings in objective c in iOS9

Related

iOS how to programmatically launch WIFI page from Settings App? [duplicate]

This question already has answers here:
How to open Settings programmatically like in Facebook app?
(15 answers)
Closed 7 years ago.
In my iOS application, I'd like to make a method
that opens/launches the Settings Application,
>> particularly the WIFI page, where you pick a wifi SSID <<.
I know it is possible to open Settings App.
cf How to open Settings programmatically like in Facebook app?
Is it possible to land on the Wifi page of it?
If yes, how?
Now, using the UIApplicationOpenSettingsURLString you can get the URL used to open the Settings app.
Because this is iOS 8 only, on iOS 7 or earlier you will need to check this exists before using it (or your app will crash)
if(&UIApplicationOpenSettingsURLString != nil)
{
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:UIApplicationOpenSettingsURLString]];
}
Hope this helps you

Discover Launch URLs (iOS)

Is it possible to discover launch URLs of installed apps on an iOS device?
(AudioBus does know which apps are installed, somehow, and its "Select Input" box shows just those that are available for input)
Likely what AudioBus does is use -[UIApplication canOpenURL:] to check if a URL handler is registered on the device. It requires a list of URL schemes beforehand tho (AudioBus seems to require developers to register apps, as does Facebook), and any app can claim to handle any URL as far as I can tell, so it's never a definitive solution...
Example:
if ([[UIApplication sharedApplication] canOpenURL:[NSURL URLWithString:#"googlechrome://example.com"]]) {
// Google Chrome is likely installed on the device
}
You might also want to look at inter-app audio introduced with iOS 7 for the topic of sharing audio between apps.

How to show alert to activate cellullar data iOS

How to check in my iOS app if my cellullar data are turned off, and show this alert to navigate to it on settings and turn it on.
For example check the image!
Apple has some sample code available named Reachability which you can use to see if the Internet is available.
If WiFi is down, you can bring up your own "You can turn on cellular data for this app" UIAlertView.
Well, iOS 5.1 removed the ability to open Settings, so basically you can't do it in iOS >= 5.1
for iOS < 5.1 was something like that
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=General&path=Network"]]

iOS CoreLocation: How to handle programmatically if location services are disabled from device settings

I am trying to get the geolocation of the iOS device. I am able to get the coordinates of the present location using CoreLocation framework.
But the problem is I have to handle the scenario when location services has been disabled from device settings. In that case, I have to redirect the user to settings from within my app as per the requirement.
I know that I can do this using the below scheme prior to iOS 5.1
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
But, how to handle this in this newer releases. I am stuck with this since a long time and no solution yet. Please advise.
You should call:
[CLLocationManager locationServicesEnabled]
As it states here:
http://developer.apple.com/library/ios/#documentation/CoreLocation/Reference/CLLocationManager_Class/CLLocationManager/CLLocationManager.html
#Rashmi - You might be getting some trouble some where else.
CoreLocation Framework automatically detects if the Location Settings are disabled from the Device via generating an alert and take you automatically to the device settings.I had verified this in iOS7, iOS6 devices.
Moreover, I Googled and found that this is the only way to open setting from the app and that matches with you have written.
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs://"]];
You can also follow this URL for reference
Open Device Settings from the app
For Core Location, You can see this demo CoreLocation

Accessing Settings app values and opening it if needed

I have seen that there are known apps, such as Twitter and Facebook, that display a "Turn Off Airplane Mode or Use Wi-Fi to Access Data" message within an alert view, with a button that switches to the Settings app, when no network is detected as the app goes foreground. This message is the same in all apps where I saw it, is this alert view a kind of predefined one that you can use? Similar to the one displayed when checking locationServicesEnabled...
I found some posts dealing with this issue some time ago, for example:
iOS UIAlertView button to go to Setting App, and it seems (or seemed) to be a way to read the values in the iOS' Settings app, but I couldn't find any of this in the Apple Developer's documentation... is there any public API for accessing those values? Would an app be rejected if accessing them as in the post I linked?
Thanks in advance
Till iOS 5.0, you can use the URL scheme to open the Settings App from third-party apps using the URLScheme like:
[[UIApplication sharedApplication] openURL:[NSURL URLWithString:#"prefs:root=WIFI"]];
Unfortunately, iOS 5.1 and iOS 6 not supports this feature.
You can use the Reachability for checking the Wi-Fi state.
For displaying the default alertview when the Wi-fi is off or in AirPlane mode you can use the Application uses Wi-Fi flag in the info.plist
Refer InfoPlistKeyReference for details:
UIRequiresPersistentWiFi
“Application uses Wi-Fi”
Specifies whether this app requires a Wi-Fi connection.

Resources