Android Question How can I detect hook switch without focus

Levisvv

Member
Licensed User
I know that while my app has focus I can capture this event:
If KeyCode = KeyCodes.KEYCODE_HEADSETHOOK

but I need to capture this event in a service even when my app is not in focus (not in the foreground)
does anybody know the best way to accomplish this?
 
Top