0

I'm trying to get the application usage list in android lollipop using UsageStatsManager, for that I have gone through the android developer document https://developer.android.com/reference/android/app/usage/UsageStatsManager.html I don't know how to use UsageStasManger, so I referred few links How to get list of recent apps with Android API 21 Lollipop? Android Lollipop know if app as Usage Stats access and implement in my project but I didn't get any data from UsageStausManager? how do I Use UsageStausManager in my project. Anyone help me out.

Community
  • 1
  • 1
Somasundaram NP
  • 1,018
  • 1
  • 12
  • 36

1 Answers1

1

From lollipop we will not be able to use the activity manager for determining the current foreground tasks. we have to make use of the Usage Stats Manager. Wrote a small code and answered in this thread

Determining the current foreground application from a background task or service

You can have a look at this thread by me.

Suman
  • 4,221
  • 7
  • 44
  • 64