Reputation: 709
I have been trying to fetch Back Key Press in Service, but I am having no result. In Activity there is function onKeyDown() which recognises various key events. Is there a way in Service to determine if Back Key was pressed.
Upvotes: 1
Views: 955
Reputation: 38168
An option could have been to register a broadcast receiver for an action matching the home key press but I can't find any.
Upvotes: 0
Reputation: 86958
A Service is not intended to work directly with user actions, so no. But if this Service is running at the same time as your Activity, then the Activity could notify the Service that the back key has been pressed.
Upvotes: 1