I have an Android service that runs in background. I need it to recieve feedback (and stop, for example) just 开发者_如何学Cwhen user did something, no matter if it's only touch event on homescreen of somewhere else or key press.
Is it possible to handle global touch and key events?
While I highly doubt that there is an easy way to do this, you can register intents and intercept the messages for your own purpose. Have a look at the intent library for specific intents that you might hijack for your application. You may find further information in the android documentation on intent filters.
精彩评论