-1

Is there any way to get the mobile data and the memory consumed by an app through code. As like it show on the App setting page, I need to show the details within the app. Kindly suggest App Settings screen

Yamuna
  • 119
  • 1
  • 8

2 Answers2

0

you can do it using Profiler but you cant get it programatically

https://developer.android.com/studio/profile/android-profiler

details about each of the profilers, see the following:

Inspect CPU activity and traces with CPU Profiler Inspect the Java heap and memory allocations with Memory Profiler Inspect network traffic with Network Profiler Inspect energy usage with Energy Profiler

Chanaka Weerasinghe
  • 5,404
  • 2
  • 26
  • 39
  • Thanks for your response. I already read about the Profiler and I just posted the question to know anyone tried via code. – Yamuna Aug 27 '19 at 05:09
0

For Data usage you can try this below code it will return the number of bytes received across mobile networks since device boot:

Toast.makeText(this, android.net.TrafficStats.getMobileRxBytes()+"Bytes", Toast.LENGTH_SHORT).show();

For memory consuption you can refer this duplicate question:

Geekfreak
  • 13
  • 10