Android-set onTouchListener en servicio
Frecuentes
Visto 721 veces
0
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
?
2 Respuestas
0
I don't see how onTouchListener can help you with a service...you might wanna try some BroadcastReceiver like approach. For instance, maybe detect if the screen is turned ON or OFF?
see the intent action: http://developer.android.com/reference/android/content/Intent.html#ACTION_SCREEN_ON
Respondido el 22 de Septiembre de 13 a las 01:09
-1
This might be of help, try it out! http://www.kpbird.com/2013/03/android-detect-global-touch-event.html
respondido 21 nov., 13:13
No es la respuesta que estás buscando? Examinar otras preguntas etiquetadas android android-layout android-service or haz tu propia pregunta.
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 app..read more about android.intent.category.HOME - Alecio Carvalho