iOS 7 introduced a new user configuration to disable cellular data for specific apps. It can be configured in "Settings"->"Cellular" and then scrolling down.
You'll find a switch for each installed app and can see how much cellular data it has consumed.
How can I programmatically test if the switch is turned on for my app? Is there an API for that? Can I determine how much data my app has used over cellular?
I'm not asking to get the values for all apps. I'm only interested in my apps usage.
To see how much cellular data you've used, go to Settings > Cellular or Settings > Mobile Data.
To set options when Cellular Data is on, go to Settings > Cellular > Cellular Data Options, then do any of the following: Reduce cellular usage: Turn on Low Data Mode, or tap Data Mode, then choose Low Data Mode. This mode pauses automatic updates and background tasks when iPhone isn't connected to Wi-Fi.
Cellular Data connects your iPhone to the internet when you're not connected to Wi-Fi. When Cellular Data isn't on, your iPhone can't access the internet when you're on the go.
In Settings, choose “Cellular.” When you're in Cellular settings, you'll see several options with switches. Scroll down below that and you'll find a list of apps installed on your cell phone. They are sorted by how much cellular data they have been using, with heavy offenders at the top of the list.
There is no API to detect your download consumption or whether cellular is active for your app.
If your app tries to connect to a website, but cellular is turned off, then iOS may ask the user to turn cellular back on. I'm not exactly sure how that works, but it is probably similar to the iOS 6 "no network connection" alert that would pop up if there is no connection but an app tries to access the internet.
You can check if the current internet connection is over WiFi or Cellular, but if Cellular is disabled you will just be told that there is no network connection.
More details here: iOS Detect 3G or WiFi
You can't check if the cellular data switch is turned on.
kSCNetworkReachabilityFlagsIsWWAN
flag.allowsCellularAccess
property.Reference: https://developer.apple.com/library/ios/documentation/NetworkingInternetWeb/Conceptual/NetworkingOverview/Platform-SpecificNetworkingTechnologies/Platform-SpecificNetworkingTechnologies.html
This answer suggests how data usage can be measured system-wide: iPhone Data Usage Tracking/Monitoring
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With