Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

iPhone iOS: how to detect when in roaming? (Not for jailbreaked phones)

I'm coding an app with heavy network usage. I've been told to warn users for costs but only when in roaming mode. I know theres some way to know when the phone is roaming comparing two undocumented files on jailbreaked iphones. But I need to find out how to for non jailbreaked phones. BTW found nothing at SCNetworkReachability api.

Ty!

like image 872
Martha Avatar asked Nov 14 '11 19:11

Martha


2 Answers

There's no way to know if they're roaming using the API. You can find out if they're on Wifi or Cellular, but that's it.

like image 168
Randall Avatar answered Nov 15 '22 09:11

Randall


You can get the user's home network country code from CoreTelephony. There are lists to map MNCC ( mobile network country code) to a real country code.

Next get your location, from CoreLocation, and get an address from that using geolocation.

Compare one to the other, and there you have it.

Not 100% reliable near borders, but good enough for a warning message.

like image 1
Gordon Dove Avatar answered Nov 15 '22 08:11

Gordon Dove