So after getting sidetracked with other upgrades and updates, I finally got to working on updating my Android app to use the latest version of the software development kit, version 21, called Lollipop.
As I started reading about the changes, I realized that Android was deprecating an api called getRecentTasks with a new package called android.app.usage.
At first glance, it looks like this new API will give me a lot of the same information that I struggled to get on my own. Because this API didn’t exist before, I had to do use Broadcast Receivers to periodically check on the state of the phone and figure out which app was in the foreground. I always had some lingering fears that I was draining the phone of its power or could potentially do some other damage to the phone by having something run in the background so often.
So the new android.app.usage API is great news. I can rely on that to fetch data, instead of my own home spun solution.
Of course, things aren’t so simple. Since many phones will not have the latest APIs, I will still have to support using my own home-made solution, and switch depending on whether a phone is ready.
I think it will be an interesting software challenge to refactor my code to support both the old and new sets of APIs, while keeping my code as clean as possible …
No comments:
Post a Comment