2

How do I keep receiving onTouchEvent when my app is in "onPause" or "onStop" status?
In other words, I want to know if I made ACTION_DOWN or such gestures while my app is running on the background. Of course, when I exit the app, it shouldn't work. Can someone help me on this? Thank you so much

user2168
  • 309
  • 8
  • 15

2 Answers2

1

I don't know if there is a general system mechanism that can be used for this purpose but it will not work with the normal onTouchEvent. This event is assigned to a view - and this view will not be visible when your App is paused or stopped. So I guess you have to look for some kind of system event and nothing that is assigned to an App-local view.

Elmi
  • 5,899
  • 15
  • 72
  • 143
1

Create a window of type TYPE_SYSTEM_OVERLAY. You need extra permissions for this. This window will receive the touch events.

Update: It seems as this only worked before: TYPE_SYSTEM_OVERLAY in ICS

Community
  • 1
  • 1
Tobias Ritzau
  • 3,327
  • 2
  • 18
  • 29