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
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
Post a Comment