6

In my app I want to be able to detect if the cellular data usage is on for a particular application, and depending on the result of the check act appropriately.

Is there a way to perform this programmatic check?

esqew
  • 42,425
  • 27
  • 92
  • 132
Eugene Gordin
  • 4,047
  • 3
  • 47
  • 80
  • **Answer**: Use the well-documented [Reachability framework provided by Apple](https://developer.apple.com/library/ios/samplecode/reachability/introduction/intro.html). – esqew Nov 06 '14 at 02:38

1 Answers1

0

Go to the following link:

https://developer.apple.com/library/ios/samplecode/reachability/introduction/intro.html

download and import the header and iplementation file, then use this code:

Reachability *reachability = [Reachability reachabilityForInternetConnection];
NetworkStatus status = [reachability currentReachabilityStatus];

if (status == ReachableViaWWAN) 
{
    NSLog(@"Cellular data");
}

This project is a little old, you might need to turn ARC mode off see this answer:

How can I disable ARC for a single file in a project?

Community
  • 1
  • 1
meda
  • 45,103
  • 14
  • 92
  • 122
  • 4
    thank you for your answer! but this code checks if cellular is on. It doesn't check if cellular data is on for a specific app installed on the phone. – Eugene Gordin Nov 06 '14 at 03:37