0

I'm making an android service that relies on the accelerometer, and therefor i can't allow the device to go to sleep. because of this http://code.google.com/p/android/issues/detail?id=3708#makechanges

i have a ScreenReceiver class that catches the action of screen off, when the device goes to sleep, and counters this action.

But, to save battery life, i'd like to dim the screen more than default by a dim lock, and then lighten it up again when the screen is touched. Ive only been able to find info on how to use the ontouch() events in an application ( http://developer.android.com/guide/topics/ui/ui-events.html ), and not a way to let a service receive touch events.

Is this possible, and if so, can anyone point me to some info on how to do so?

user728732
  • 15
  • 6

2 Answers2

2

In service to receive touch events, it is now possible Link1 Link2 ;)

Community
  • 1
  • 1
ozbilgic
  • 81
  • 10
1

It is impossible for a service to receive touch events. Only the foreground activity will receive touch events.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491