Can I prevent iPhone from using 3G under any circumstances?
Asked Answered
T

4

12

I'm writing a travel guide related app that will download large databases (60meg) potentially overseas, with the reachability code I can tell when a host is reachable via wifi or 3g BUT I'm worried that if for some reason the wifi connection breaks for a minute or so as some DSL connections are likely to do on occasion the iphone will switch transparently to 3G and without realising I could be racking up someones phone bill with overseas data charges!

So I'm wondering if anyone has any experience, in the event of such break in wifi connectivity (wifi still works but it's connection to the net is down) would the reachability code report ReachableViaWWAN? So I could wait till my download code returns, check how the host is currently reachable and if it's via 3g I could abort?

Is it possible to select what type of connection I can use aka 3g or wifi exclusively?

Takeshi answered 11/6, 2010 at 14:5 Comment(3)
It's nice to see a developer concerned with not screwing his users over. Have an upvote.Amorino
If you do have control over which network to use, perhaps make it a user-configurable setting. Some people might not mind falling back to 3G when needed (e.g., they have the new 2GB plan and don't mind a 60MB download).Beaton
It is intended to be user configurable but I have to have some way of implementing it if they say "no 3g for downloads".Takeshi
B
5

If you look in the Reachability sample, in Reachability.h, there's a constant defined as "kReachabilityChangedNotification." If you ask to be notified of changes—assuming that this works as it sounds like it does—you could stop the connection when it drops down to 3G.

Brisling answered 11/6, 2010 at 14:17 Comment(1)
Yes from reading up on it this looks like the only way. Just a lot of debugging to test it works as expected I guess.Takeshi
U
1

Under Settings->General->Network there is "Data Roaming". This allows you to turn off roaming onto other data networks when traveling internationally. The user already has a choice there whether to allow expensive 3G connections when traveling.

Underscore answered 11/6, 2010 at 14:17 Comment(2)
ahhh o.k that might be handy.Takeshi
you bet, i always keep it off since i'm near the borderUnderscore
M
0

Yes, under settings->general->network, you can shut-off 3G. But the iphone will still use non-3G cellular.

Alternatively, when I travel overseas I put the iPhone in airplane mode, and then turn wi-fi on manually.

Milda answered 11/6, 2010 at 14:10 Comment(3)
I think the OP is asking if they can disallow 3G data programmatically from within the app, like the Skype app did.Shuck
OK, wasn't clear, but on second reading I think you are right.Milda
Yes, but thank you for that I didn't know you could turn on wifi during flight mode.Takeshi
G
0

No; Unix-style IP doesn't work like that. Using the reachability code will do mostly the right thing, but there's still a chance you'll send a few packets over 3G before you handle the notification.

It's probably safe to assume that users who don't turn off "data roaming" will do so very quickly. On the other hand, many users won't have unlimited internet plans.

One option is to display something like "Not connected over Wi-Fi, do you want to download lots of data over the cell network? You might be charged." and store it in a setting.

Gerhardine answered 11/6, 2010 at 19:51 Comment(1)
FYI, AT&T's moving towards limited data plans, which are cheaper if you stay below 2G a month (I never get anywhere close, myself). Unlimited accounts are currently grandfathered in, but new accounts will have 1G or 2G limits, with I think $10/G after that and a cost cap for the month.Gaius

© 2022 - 2024 — McMap. All rights reserved.