0

I was using the following code to find the activity curently in foreground

ActivityManager am = (ActivityManager) getApplicationContext()
                        .getSystemService(getApplicationContext().ACTIVITY_SERVICE);

List<ActivityManager.RunningTaskInfo> taskInfo = am.getRunningTasks(1);

untill 4.4.4 . Now in API 21 getRunningTasks() is deprecated. My requirement is to find the current foreground application running.

Not the top activity of my own app but the current activity running

Thanks in advance.

Nishant Virmani
  • 215
  • 1
  • 2
  • 10
  • @Nikola the link you shared talks about "top activity of my own app" but I'm looking for any activity ... it may or may not be of my app – Nishant Virmani Nov 24 '14 at 14:50
  • possible duplicate of [Determining the current foreground application from a background task or service](http://stackoverflow.com/questions/2166961/determining-the-current-foreground-application-from-a-background-task-or-service) – b4hand Dec 04 '14 at 06:48

0 Answers0