0

Using Neworkstats manager i am able to access to network usage history and statistics from marshmallow devices.If that app runs in below marshmallow unfortunately stopping with the below error.

Caused by: java.lang.ClassNotFoundException: Didn't find class "android.app.usage.NetworkStatsManager" on path

My app shoul work below and after marshmallow devices.How can i achieve this.Any help appreciated...

Thanks in advance.....

Narender Reddy
  • 463
  • 6
  • 18

1 Answers1

2

As you can see here https://developer.android.com/reference/android/app/usage/NetworkStatsManager.html this class was added in API 23. Meaning you can't access that data prior to 6.0. What you can try to do for < 6.0 is count traffic for your application using this class: https://developer.android.com/reference/android/net/TrafficStats.html

Robert K.
  • 1,043
  • 1
  • 8
  • 20