Levisvv Member Licensed User Longtime User Mar 19, 2016 #1 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?
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?
Erel B4X founder Staff member Licensed User Longtime User Mar 20, 2016 #2 You can try to intercept it by intercepting the android.intent.action.MEDIA_BUTTON intent. It is difficult to get it working reliably as this intent is caught by other OS apps on many devices. Upvote 0
You can try to intercept it by intercepting the android.intent.action.MEDIA_BUTTON intent. It is difficult to get it working reliably as this intent is caught by other OS apps on many devices.