networking - Android : How to get Internet Data Usage per Day or by range of time? -


i trying exact data usage per day , or range of time in android

however searched, cannot found

something tried

trafficstats

this 1 reset data every time device boot, couldn't use it


networkpolicymanager

this 1 require system permission. so, can't use it

any appreciate

you need have service periodically call trafficstats apis current statistics, , store results. e.g. delta between 2 invocations of getmobiletxbytes() number of bytes received during time period.

of course, if pulls battery out of phone, you'll lose statistics since last invocation of service. set frequency of updates according needs (every hour versus every minute).


Comments

Popular posts from this blog

android - MPAndroidChart - How to add Annotations or images to the chart -

javascript - Add class to another page attribute using URL id - Jquery -

firefox - Where is 'webgl.osmesalib' parameter? -