Android Question Requesting App-Traffic (Mobile/WiFi) and Power-Consumption?

Discussion in 'Android Questions' started by manuel-r, Oct 2, 2015.

  1. manuel-r

    manuel-r Member Licensed User

    Hi @All
    Can anybody explain me how to request the data about app-traffic (WiFi and mobile) and the power comsumption? Is there any library to do this? The OS nows this data (see screenshots) so it should be possible to request it.

    Android App Traffic WLAN.PNG Android App Traffic MOBILE.PNG Android Akku.PNG
     
  2. DonManfred

    DonManfred Expert Licensed User

    only when google published an api to do. I dont know about it, sorry.
    I know there is a usagestats api available introduced in Lollipop. See this thread for more info. But i´m not sure it is what you are searching for.
     
  3. manuel-r

    manuel-r Member Licensed User

    I use an app called "Traffic Monitor Plus" (https://play.google.com/store/apps/details?id=com.radioopt.tmplus). This app can show me the same (historical) data as android can do. So I think there must be any way to get this data. I need to build in this funcionality in a corporate app. So I'd be very happy if there would be a way to do it.

    AppScreenshots:

    Screenshot_2015-10-02-10-13-15.png Screenshot_2015-10-02-10-13-10.png Screenshot_2015-10-02-10-13-05.png
     
  4. Erel

    Erel Administrator Staff Member Licensed User

    DonManfred likes this.
  5. manuel-r

    manuel-r Member Licensed User

    Thank for the link.
    I think I have to use "getUidRxBytes" and "getUidTxBytes". But: How do I get the UIDs for all installed packages by PackageName?

    If I do it this way I have to write the complete logic for counting WiFi- and Mobile-Traffic per App. If I'm right the OS resets the counters at each reboot. So I have to request the stats each second or minute with a service.

    Isn't it possible to ask the os-integrated stats as show in the screenshot in first post?
     
  6. Erel

    Erel Administrator Staff Member Licensed User

    These are the available APIs in Android.
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice