What approach should I prefer? I want my solution to work on android 4.2 upwards, also in L and M.
getRecentTasks - won't work in android L anymore...
AccessibilityService - I monitor the active apps myself and so I can show a list of recent apps, always, without quering any android resource.
UsageStatsManager - I query the manager everytime I need infos and so I can show the recent apps
Question
- Which approach is better than the other? Especially, concerning energy consumption? I don't want my app to consume more battery than necessary...
- Does anyone know an alternative solution? Or even a better one?
Currently I decided to use the AccessibilityService
, as I read, that the UsageStatsManager
can be quite slow if I query a long period and my app would always query the total up time period...