accessibility service in android?

567 views Asked by At

Has anyone implemented accessibility service? I have a requirement where in I need to know when home key is pressed from a service. I am wondering if AccessbilityService is the solution .unfortunately there are not many tutorials on the same ? Any code examples available?

2

There are 2 answers

0
MimmoG On

You cannot determine when home button is pressed...

0
Preethi On

Accessbility service can be used , if you know the home package( which can be inferred from logcat) then event is generated when user goes to home screen

NOTE : But the user has to explicitly set the Settings -> Accessibilty ->Check the application name .

There is another way to know when the home screen is invoked , from service . Start reading the logs to know when home intent was sent though i am not sure whether it is the right way .