Android Question Detect Activity_Touch while screen is dim

Arf

Well-Known Member
Licensed User
Longtime User
Hi,
I need to create a situation whereby while my activity is running, a touch of the screen results in code jumping to the Activity_Touch function. This must happen regardless of what state the screen is in (powersave dim or off).

I know when the screen is off my activity won't be running, so this means I must prevent this situation, which I can do with reflection and FLAG_KEEP_SCREEN_ON.

However, my app could be running a long time, so I want to allow screen dimming, so instead of doing the above, I tried pw.PartialLock.

On the samsung S3 I am developing on, this seems to have no effect - the screen turns off after 2 mins and my taps are ignored.

So my question is, why does partial lock no work on the samsung device? Or have I misunderstood what it does? And, are there any better ways to achive my goal (for example detecting touches from a service, but I wouldn't know how to detect touches from a service).

Thanks
 

Arf

Well-Known Member
Licensed User
Longtime User
Um, sorry. I see KeepAlive(BrightScreen) is probably what I should be using! Would still like to know if I can detect a screen touch from a service though. Thanks.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
This must happen regardless of what state the screen is in (powersave dim or off).
If the screen goes into slepp your app will be suspended before.
At the point the Screen goes off your app is already in background. No chance to get any more touch events.
 
Upvote 0
Top