Network Data Usage for a given session or day

sasidhar

Active Member
Licensed User
Longtime User
Hi all,

Can anyone tell me how to identify the data service(network service provider) used by the application for a given day.

Event by event is want store how much data is utilized by network.

Thanks
Sasidhar.M
 

Erel

B4X founder
Staff member
Licensed User
Longtime User
You can call the TrafficStats API: http://developer.android.com/reference/android/net/TrafficStats.html
For example:
B4X:
Dim jo As JavaObject
jo.InitializeStatic("android.net.TrafficStats")
Log(jo.RunMethod("getMobileRxBytes", Null))
Log(jo.RunMethod("getTotalRxBytes", Null))

The counters are reset during boot. This means that you will need to use a service that starts every hour and tracks the new values.
 
Top