0

Attempting to make a kiosk type application/launcher on android and I need a way to detect if no user is present and/or interacting with the device.

In the app I'm writing I'm storing the last touch time and running a thread that determines how long it's been since the last touch... of course that last touch time doesn't get updated from 3rd party apps.

My problem comes in that we're going to allow the user to launch 3rd party apps and I need to detect touches to the screen from those apps to detect that the screen has had no touches/been idle for x amount of time.

Thanks

Ryan
  • 6,756
  • 13
  • 49
  • 68
  • This question may be of some use, sounds like they recommend making a launcher which may be more suited to what you are doing. http://stackoverflow.com/questions/4632608/android-detecting-the-touch-state-from-any-application – Demonslay335 Nov 11 '13 at 14:18
  • This one may also help.. http://stackoverflow.com/questions/11346557/how-to-detect-when-the-user-launches-another-app-android – NG. Nov 11 '13 at 14:21

1 Answers1

0

I need to detect touches to the screen from those apps

Fortunately, that is not possible, for blindingly obvious security reasons.

You are welcome to listen to ACTION_SCREEN_OFF broadcasts, though I suspect in your use case, those will come too late or not at all.

Beyond that, I know of no way of achieving what you want without a custom ROM containing a modified version of Android that has the hooks that you are seeking.

CommonsWare
  • 986,068
  • 189
  • 2,389
  • 2,491
  • Is there nothing I can use to determine when the last touch event came in globally? I don't care about any other information other than when the touch event happened. I don't see how knowing only when the last touch took place opens up a giant security hole. – Ryan Nov 11 '13 at 15:38
  • @Ryan: "Is there nothing I can use to determine when the last touch event came in globally?" -- nothing in the Android SDK. "I don't see how knowing only when the last touch took place opens up a giant security hole" -- *that* doesn't. That is not what you asked for in your question. – CommonsWare Nov 11 '13 at 15:48
  • Thanks for the info. Appreciate it. – Ryan Nov 11 '13 at 16:15