I am developing an mobile application where I need to check if the device is connected to internet and if it is not connected then it should show an popup saying you are not connected to internet and it should have a option for settings on clicking which it should to take the settings of the mobile where the user can turn on the WIFI or mobile internet
There are two questions:
need to check if the device is connected to internet and if it is not
connected then it should show an popup saying you are not connected to
internet
You can use the WL.Device.getNetworkInfo API method, for example:
function wlCommonInit() {
WL.Device.getNetworkInfo(function (networkInfo) {
if (networkInfo.isNetworkConnected) {
alert ("connected");
} else {
alert ("not connected");
}
});
}
should have a option for settings on clicking which it should to take
the settings of the mobile device where the user can turn on the WIFI or
mobile internet
This could probably be implemented using a Cordova plug-in. Find a Cordova plug-in that allows you to open the settings screen of the device or even deeper, the settings > network setting screen of the device, there the user could do it. However, I would simply tell the user to go there on his own and not implement that... your choice, more complicated.
Related
I have trouble with registration WP8.1 device to developer account. My account is active. Device early was active, but I reset phone (Nokia 620) and after that Developer tools don't active this phone.
In list (in dev acc) this phone was remove.
after I press "register" show this window:
and that's all. Second window close after few seconds and register process don't finish. Please help :)
Make sure your computer have internet connection. I had similar issue when network proxy was configured incorrectly .
Also try after clearing internet explorer cached content (history,password,cookies etc.)
I would required to implement the OSX application online/offline mode.
When internet is available the app icon should online() otherwise the icon should change to offline().
I have implemented checking the internet connection availability(Refered Reachability sample code) but i don't have idea about how to implement online/offline mode like continuously checking the internet connection and update the icons.
Please guide how to achieve the functionality.
My question is about private API in IOS. Is there some API to manage WiFi connection? For example I'm using Apple80211.framework to scan WiFi networks but it's unusable for connecting.
My app isn't for appstore.
We can programmatically connect wifi networks after iOS 11 public API. You can connect wifi using SSID and password like following.
Swift
var configuration = NEHotspotConfiguration.init(ssid: "wifi name", passphrase: "wifi password", isWEP: false)
configuration.joinOnce = true
NEHotspotConfigurationManager.shared.apply(configuration) { (error) in
if error != nil {
//an error occurred
print(error?.localizedDescription)
}
else {
//success
}
}
Don't forget import NetworkExtension.
I ran into this issue last year and after quite a bit of digging I came across a helpful example called SOLStumbler. For this app to work your device must be jailbroken. I modified SOLStumbler and threw up a sample app on github. It uses the IPConfiguration bundle to access Apple80211 framework, which allows you to associate to a network. The readme contains the custom build instructions.
https://github.com/devinshively/wifiAssociate
No need for private API any more! With iOS 11, Apple provided a public API you can use to programmatically join a WiFi network without leaving your app.
The class you’ll need to use is called NEHotspotConfiguration.
To use it, you need to enable the Hotspot capability in your App Capabilities (Adding Capabilities). Quick working example :
NEHotspotConfiguration *configuration = [[NEHotspotConfiguration
alloc] initWithSSID:#“SSID”];
configuration.joinOnce = YES;
[[NEHotspotConfigurationManager sharedManager] applyConfiguration:configuration completionHandler:nil];
This will prompt the user to join the “SSID” WiFi network. It will stay connected to the WiFi until the user leaves the app.
This doesn't work with the simulator you need to run this code with an actual device to make it work.
More informations here :
https://developer.apple.com/documentation/networkextension/nehotspotconfiguration
It's possible in any version of iOS which can load a configuration profile: the app needs to generate a profile with the desired network credentials, and host a web server which provides the profile to Mobile Safari.
If there is no internet connection and you start for example the safari app with Ipad or Iphone, a popup appears saying: "Choose wireless network"
Is there a way to force this popup to show up in my app when I want to?
The problem is, I have a button in my app which connects the user to facebook. After pressing the button the safari browser opens and shows the facebook authorization page. If there is no internet connection this popup appears, but there is no way to turn back to the app from there. So currently I check internet connection before allowing this authorization page to appear, but I also want to show this popup.
It will show up automatically if your app tries to access internet-based resource and there's no wifi connection established but there is a wifi access point nearby.
This dialog appears automatically if you have "Application uses Wi-Fi" set to YES in your ...-Info.plist and if there is no connection.
This is not possible. The pop-up you have seen before is in Settings -> Wi-Fi -> Ask to Join Networks -> ON/OFF
Setting this to ON allows the OS to prompt the user to join a Wi-Fi network if it finds any in reach and you are not currently connected to one.
Apps cannot show this prompt, it's a system-level prompt.
I'm having a problem with my iPad app not bringing up the WiFi authentication when it tries to access the network. When I first open the app and need to connect the panel will show, however if I lock the iPad and come back to it after the WiFi login session has timed out, the panel doesn't display.
Is this something I need to be coding for? My understanding was the panel came up automatically whenever you tried to use the network.
I don't think you can code for it. Probably the user needs to toggle the wifi connection (switch it off and on) to get iOS to reconnect.