Android 5.1.1: No "Last Used App"

I have an Android 5.1.1 tablet (Samsung A6).
Although both the code and the UsageStatsManager doc tell me that I should have access to the “Last Used App” sensor, I don’t.

5.1.1 = API 22 (I think)
UsageStatsManager = API 21

Any idea?

At the end of the day, I’m only interested in knowing if the HA companion app is the frontend activity. Would there be another way to know that?


looks like the docs are out of date, the actual sensor itself requires Android 6

yes use the app importance sensor and the state will be foreground when the app is open

Sure it’s not a bug?
That stack overflow seem to infere it should work as of L…

At the least, the test seem in contraction of the @RequiresApi

Anyway, will test with the app importance. Thanks

no because the required permission is android 6

Whatever :wink:
App importance works for me. Thanks

1 Like

thanks for letting us know the docs were out of date, they are updated now :slight_smile:

1 Like