iAsh
iAsh

Reputation: 447

Device total download and upload data

I am developing iPhone app where I want to display how much data downloaded and uploaded from device. I didn't find any public APIs to do this. But I fount one app 'OpenSignal' which does the same thing. here is the link for OpenSignal app.

Any help how to detect how much data downloaded or uploaded from the device.

Any help?

Upvotes: 0

Views: 162

Answers (1)

Wain
Wain

Reputation: 119031

This can be done using getifaddrs. You will need to iterate and search for the appropriate data. You're looking for a record where sa_family == AF_LINK and then you can check which interface it is part of and get the number of bytes. There are restrictions such as when this record gets wiped to zero. man page (google is also your friend for usage details).

Upvotes: 1

Related Questions