2

I am opening DATA USAGE screen on button click from my application, using the following Intent:-

Intent intent = new Intent(); intent.setComponent(new ComponentName("com.android.settings","com.android.settings.Settings$DataUsageSummaryActivity")); startActivity(intent);

Now I want to read the data usage of a particular application, say YouTube, and print the same on an EditText in my application. Can anybody suggest how to achieve this?

  • 1
    Maybe over https://developer.android.com/reference/android/app/usage/NetworkStatsManager.html or https://developer.android.com/reference/android/app/usage/UsageStatsManager.html – GoneUp Oct 07 '16 at 10:38
  • 2
    Fortunately, this is not generally possible. Apps cannot spy on the UI of other apps, for obvious privacy and security reasons. – CommonsWare Oct 07 '16 at 10:46
  • @CommonsWare...I agree with your answer, but what if my app's requirement is that I print data usage of a particular app, from Settings to my app? In this case, can't I read those data? – Kaushik Saha Oct 07 '16 at 10:55

0 Answers0