Android-set onTouchListener en servicio

Tengo un Service in my app which detects whether the user has touched the screen or not. The problem is where should I set the onTouchListener to listen for the touch whenever/wherever the user touches the screen?

I know how to set this listener for a layout. But what about Service?

preguntado el 22 de septiembre de 13 a las 01:09

2 Respuestas

I don't see how onTouchListener can help you with a might wanna try some BroadcastReceiver like approach. For instance, maybe detect if the screen is turned ON or OFF?

see the intent action:

Respondido el 22 de Septiembre de 13 a las 01:09

I want to achieve something like, if user swipes right, then perform some task. This swiping can take place anywhere,not just inside my application. - naddy

You can only do that if you're app is a HOME Launcher more about android.intent.category.HOME - Alecio Carvalho

respondido 21 nov., 13:13

No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas or haz tu propia pregunta.