Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Data usage from any application

I want to read how much data from 3G every app uses. Is this is possible in iOS 5.x ? And in iOS 4.x? My goal is for example:

  • Maps consumed 3 MB from your data plan
  • Mail consumed 420 kB from your data plan

etc, etc. Is this possible?

EDIT: I just found app doing that: Data Man Pro

enter image description here

EDIT 2: I'm starting a bounty. Extra points goes to the answer that make this clear. I know it is possible (screen from Data Man Pro) and i'm sure the solution is limited. But what is the solution and how to implement this.

like image 702
Jakub Avatar asked May 10 '12 09:05

Jakub


People also ask

How do I stop all my apps from using data?

Head to Settings in your phone menu. Select Wireless and networks > Data usage > Network access. Go through the list of mobile apps and then clear the checkbox for any particular app(s) you want to disallow from using Internet data.

What is application data usage?

The Data usage section in Android Settings lets you view the amount of data used by each specific app. If you notice an app using more background mobile data than you'd like it to (Snapchat comes to mind), you can restrict it from accessing the Internet till you're back in a Wi-Fi covered area.


2 Answers

These are just hints not a solution. I thought about this many times, but never really started implementing the whole thing.

  1. first of all, you can calculate transferred bytes querying network interfaces, take a look to this SO answer for code and a nice explanation about network interfaces on iOS;

  2. use sysctl or similar system functions to detect which apps are currently running (and for running I mean the process state is set to RUNNING, like the ps or top commands do on OSX. Never tried I just suppose this to be possible on iOS, hoping there are no problems with app running as unprivileged user) so you can deduce which apps are running and save the traffic stats for those apps. Obviously, given the possibility to have applications runnning in background it is hard to determine which app is transferring data.
    It also could be possible to retrieve informations about network activity per process/app like nettop does on OSX Lion, unfortunately nettop uses the private framework NetworkStatistics.framework so you can't dig something out it's implementation;

  3. take into account time;

My 2 cents

like image 110
GreyHands Avatar answered Sep 24 '22 08:09

GreyHands


No, all applications in iOS are sandboxed, meaning you cannot access anything outside of the application. I do not believe this is possible. Neither do I believe data-traffic is saved on this level on the device, hence apple would have implemented it in either the network page or the usage page in Settings.app.

Besides that, not everybody has a "data-plan". E.g. in Sweden its common that data-traffic is free of charge without limit in either size or speed.

like image 37
Paul Peelen Avatar answered Sep 24 '22 08:09

Paul Peelen