0

I am working in android and i am creating an app for Google TV. I am new and have no local help so i am really asking too many questions.

I want to keep track of the time in which my application is free and user does not interacts with it.

For example if user has not interacted with our application for 2 minutes, we would show him some ad etc. which will be hidden when he starts interaction or upon some "Close" button.

Its kind of screen savor.

Your help is greatly appreciated.

Aamir
  • 1,747
  • 5
  • 26
  • 50

2 Answers2

0

Use the onTouch listener in your layouts for the views that require user interactions.
At the starting of the app, start the timer, if user touches some thing cancel it and restart it again.
This way you can count the time for which user has not responded to the app.

akkilis
  • 1,904
  • 14
  • 21
  • thanks for ur reply. I will try using the onTouch listener. can i use it on the outer most layout panel in an activity? any example would be great.... thanks – Aamir Jan 15 '12 at 14:06
  • in Google TV apps users mostly do not use clicking through mouse... so relying only on onTouch listener was not enough for me... i had to call timer resetting function from multiple places .... but i did it as u guided me .... Thank u very much – Aamir Jan 17 '12 at 17:42
0

For example if user has not interacted with our application for 2 minutes, we would show him some ad etc. which will be hidden when he starts interaction or upon some "Close" button.

You seem to be assuming that your application will be in the foreground when the user "has not interacted with" your application. Most likely, that is not the case. The user will have moved to some other application (including live TV in the case of Google TV), and you will no longer be on the screen.

Its kind of screen savor.

Android does not need or use a "screen savor".

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