How do I ensure my data only goes over a WiFi connection?

binkman71binkman71 USMember ✭✭

I have found the Reachability class for iOS for detecting if WiFi is enabled; I have found ConnectivityManager for Android for the same purpose...

But, in a PCL, I am using System.Net.WebRequest .NET classes to do the handling of HTTP data.

Now, iOS documentation states that if you use a NSUrlRequest you can specify that it doesn't use cellular data. Android basically says if WiFi is connected, it uses WiFi (my interpretation anyway, could be incorrect).

We want an option in our app to indicate that it will only use WiFi data. If this option is off, obviously, any valid connection will be used.

So, if the user chooses WiFi Only, how do I ensure that only the WiFi connection is used? Can this be handled somehow? Does it need to be? Do I need to come up with a Dependency setup to call into the platform specific Internet stuff? Or can I trust that if I check for the WiFi connection, and it exists, that my WebRequests will ultimately go through the WiFi connection?

Best Answer

Answers

Sign In or Register to comment.