Wednesday, 11 September 2013

Is the RunningAppProcessInfo the best way to determine apps that might use battery?

Is the RunningAppProcessInfo the best way to determine apps that might use
battery?

In my app, I just want to display the apps that are running and might
cause a battery drain at current time.
The first thing that comes in mind is the list of running processes:
ActivityManager activityManager = (ActivityManager)
this.getActivity().getSystemService(Activity.ACTIVITY_SERVICE);
List<ActivityManager.RunningAppProcessInfo> procInfos =
activityManager.getRunningAppProcesses();
Unfortunately, this list is huge and I am not convinced that so many apps
may be running at the same time, having a probability to cause a battery
drain.
I was just wondering if you think that this code might be enough or a
different approach might do the trick.
Thank a lot.

No comments:

Post a Comment