Redirecting Data flow to either wifi or Cellular in ios - ios

I want ot redirect my iPhone data to either wifi or Cellular. Based on some criteria. Is it possible to redirect whole of the iPhone data to a particular interface like to either wifi or cellular. ?
I heard that this can be done using VPN but no idea how it can be done.
Any help on this?

By default, iOS help you with redirection when you have weak/good WiFi and switch on in Setting - WLAN Assist
MultiPath is a technology switching automatically by OS
Just read this Apple Doc for more help.
You can't manipulate it easily with high level API.
After all, changing device data flow is kind of low level thing. Just like NetworkExtension is Apple provided. As far as I know, Apple does not mention it in public.

Related

how to disable wifi assist without user interaction

I have couple of URLs that has to be called(programatically) through wifi not with mobile data.
As WIFI ASSIST is on , whenever the wifi is weak ,packets get transferred through Mobile data.
I would like to stop this from happening.
As far as I have researched, there is no API to toggle wifi assist switch on and off programatically
I can find if the user has mobile data and wifi on with the help of Reachability Class I believe and I can alert the user to keep wifi assist off but this is a very bad user experience.
so I decided to look if its possible to be done with the help of iOS mobile configuration file.
But I couldn't find any keys related with wifi-assist in Apple configuration profile reference.
so I am wondering , is it possible to force wifi to be used for certain URLs.
I remember this is possible with VPN ON DEMAND we can have certain domains to be accessed via VPN.
I am wondering if same is possible for wifi as well through configuration profile
Any suggestions are welcome.
As others have mentioned, there is no way to do manipulate this setting programmatically in iOS. This is not really what you are asking, as you seem to already know the answer to this is "No".
You are asking about the configuration profile, so I am assuming these are managed devices. Unfortunately, there is no configuration profile payload I am aware of that forces the managed devices to disable Wi-Fi Assist.
Your intent, however, is a bit different than what is being asked, I believe. I think you basically have an app that communicates with a resource that is only accessible via the Wi-Fi network (likely a corporate Wi-Fi network). If the app tries to connect to the resource while on cellular, it will not be able to connect. In some cases, when the Wi-Fi signal is weak, the device tries to be helpful and switches to cellular, causing issues with the app. If we could figure out a way to force iOS to not take advantage of Wi-Fi Assist when your app is running, you would be in good shape.
If you can install this app as a managed app, there is a way to identify that the app should only be allowed to run on a Wi-Fi connection. Setting the network usage rules AllowCellularData to false should do this (see this for more details). The thing I am not sure of with this solution, is whether this simply causes the connections to fail when Wi-Fi Assist is on and active, or if it makes iOS prefer to not use Wi-Fi assist when the app is running because it cannot connect over cellular. So I think you can tell an app to only connect over WiFi, but it doesn't really give you a better solution to your user experience problem. The only think it really buys you is that your app connection won't ever try to connect when connected to cellular. There is a chance, however, if you change this value to false for your app bundle ID, it will prevent Wi-Fi Assist from enabling when your app is running. I don't have access to MDM to try it out, but you could test and see.
Ultimately, given that this is probably a corporate device situation, I think you are going to have to address this through user training. The good news is that this is a one-time step. Sure, users may have slight degradation of network performance when Wi-Fi signal is weak but cell signal is strong. This does not matter as much if these are corporate devices where the corporate apps will mostly work only on the company's Wi-Fi network.
Another solution is what you mentioned, basically using on-demand VPN to provide a connection to the internal resources. This is additional infrastructure work, and you already mentioned it, so I'm not sure if it is even an option.
Obviously, the other solution would be to expose the network resources through your firewall, which could allow you to access it over cellular. I'm suspecting this is not possible due to security constraints.
Unfortunately, there are not a lot of good options in this space. However, have hope that there is some way to do it, as Sonos appears to have done something to
allow their app to avoid switching to WiFi Assist while streaming to a local network resource: https://sonos.custhelp.com/app/answers/detail/a_id/4257/~/wi-fi-assist-and-sonos
I wonder if you could have your app open a streaming audio connection to a fixed local network resource, which would cause it to use Wi-Fi. It's a pretty crazy hack, but with a low enough bitrate audio file streaming, it might do what you need while not eating up too much of the network throughput.
Per Apple's notes on Wi-Fi Assist:
Wi-Fi Assist won't automatically switch to cellular if you're data
roaming.
Wi-Fi Assist only works when you have apps running in the
foreground and doesn't activate with background downloading of
content.
Wi-Fi Assist doesn’t activate with some third-party apps
that stream audio or video, or download attachments, like an email
app, as they might use large amounts of data.
Of course the other possible solution that you could consider is improving your Wi-Fi coverage to that the signal doesn't get bad enough for Wi-Fi Assist to be needed. I know this may not be feasible, but wanted to put it out there.
Good luck with this!
There is no public API that allows you to enable/disable "Wi-Fi Assist", and even if you find a way to do it your app will be rejected.
No you can not enable or disable WiFi by programmatically and there is no API for this.

iOS Communicate with LTE Similar to BLE Interaction

I have a device that can be communicated with over LTE with the same functionality as you normally get through BLE.
However, I'm having a hard time understanding how you communicate with, and get callbacks from an LTE device in the same way you do with BLE.
It doesn't seem that there is a library like CoreLTE but is there a standard way to use LTE like we use BLE (CoreBLE)?
In other words, how does one do essentially something line:
func lteCentralManager(lteCentral:LTECentralManager, didDiscoverPeripheral ltePeripheral:LTEPeripheral,
...
lteManager.connectPeripheral(ltePeripheral, options:nil)
...
NOTE: I realize that the technologies are different. The above is only meant to make the point of what I'm trying to do - not imply that the calls would be the same.
If there is no standard way to do this, does anyone know a good place to start figuring it out with iOS? I've read the standards. I'm just looking for how to use it now in iOS.
Thanks for the help.
iOS does not offer APIs to interact with the LTE modem directly, so this is impossible - not to mention, even if the hardware and software was capable of it, why would the scammercarrier allow you to talk to nearby devices directly instead of going through their network where they would charge you for that bandwidth?
If you need short-range communication between iOS and Mac devices you might want to take a look at Multipeer Connectivity. Firechat uses it successfully to enable off-network chat between nearby devices.

set device cellular data on programmatically

I have requirement like when user sign up first time , I need to set cellular data on for my app in device setting.
Is there any way to set cellular data on programmatically for my app?
If no then can anyone give me reason or proof for same? And if yes how we can do that?
I have checked this link: Is there a cellular data usage API in iOS 7? and also checked iOS Detect 3G or WiFi . But can't find solution.
You can't do that, no. If the device is Jailbroken then sure, you can access private APIs and I imagine there is a way to do it. However, if you want to get on the app store, the best hope is to ask the user to enable cellular data.
That's all you can do.

Can we use WiFi Technology as Bluetooth's?

IS it possible to send data between two phones using WiFi only... That is without use of WiFi-direct, router and internet?
Are there any tutorials, Libraries or research papers ???
Well, that's exactly what WiFi direct is for... There are some other more esoteric possibilities as well, though I doubt your device supports them - check out the WiFi IBSS mode and BT HS protocol (it uses both BT and a 3rd-party RF, such as WiFi).
Yes.
If your a android user you can use this application
wififiletransfer
For IOS and other OS's they have their own WiFi direct apps.
If you a desktop user hope below article is useful
http://www.wikihow.com/Share-Files-Wirelessly

Iphone as a start button

I would like to develop an (personal) iphone app to use the iPhone as a controller for a small device such as a fan or for example a light bulb. Does anyone know if there is some kind of controllable iphone-dock to use for something like this. And are there some kind of methods to use with such a dock? For example the fan just needs a variable voltage for different rpm.
Thanks in advance,
EAAccessory requires that you become a Apple hardware partner, which is very expensive and not easy (this is why you only see large companies releasing hardware accessories for iOS devices).
There's a few ways around this. The easiest way is to have your app send OSC signals over WIFI to an OSC server. I've set this up before using TouchOSC on the iPhone and an Arduino connected to my desktop via USB. It's not hard at all, but it requires that you have an Arduino connected to a computer; it's not ideal.
Alternatively you can use audio output to send commands over the line output in the iPhone's dock connector, effectively turning the iPhone into a software modem.
Good luck and if you get this figured out, post the code on github. :-D
EAAccessory framework might not be what you want because of the requirement for you to have the license and hardware. You could better implement some sort of small webserver that runs an arduino or something similar. check this out for an example of that. on the arduino, you could just have a 5v relay to control the switch of whatever device and have the other pins of the relay connected to a hot (or cold depending on the relay state) standard 120v plug so you can plug anything into it. here is a good project for arduino controlled relay
for direct serial control, you could do something like this but it would require being jailbroken. i think for a personal app, doing it via wifi would be the best way unless you jailbreak and install the full bluetooth stack where you do not need EAAccessory stuff
Check out EAAccessory Framework. Used to handle external devices.
You could try using an ultrasound detector attached to your device, and playing an audio file at the appropriate frequency etc. on the iPhone.

Resources