3

I want to close the application when my application is idle for more than 10 min.Any one have idea.Give me some solutions.Thanks in adavance

Pinki
  • 21,723
  • 16
  • 55
  • 88

3 Answers3

1

see this link.Its working fine Close the application when it is idle for 10 min

Community
  • 1
  • 1
Pinki
  • 21,723
  • 16
  • 55
  • 88
0

Well, that's difficult: how do you define idle? No user interaction? No button presses? No scrolling by the user?

If you go with button presses as the metric for activity, I would suggest creating a Handler object, scheduling a message to be delivered in 600000 milliseconds and then any time the user presses a button cancel the message and reschedule it. If the message ever goes off you can just call finish().

Femi
  • 64,273
  • 8
  • 118
  • 148
0

you dealt with this by using the AlarmManager to schedule and cancel timeout action.

Then in the onPause() event of all of your activites, I schedule the alarm. In the onResume() event of all of your activities, You have to check to see if the alarm goes off. If the alarm went off, you will finish your app. If the alarm hasn't gone off yet you cancel it.

You have to create Timeout.java to manage my alarms. When the alarm goes off a intent is fired:

Have a look on the following URL

Lock android app after a certain amount of idle time

Thnaks Deepak

Community
  • 1
  • 1
Sunil Kumar Sahoo
  • 53,011
  • 55
  • 178
  • 243
  • Thanks Deepak.I am tried with http://stackoverflow.com/questions/4075180/application-idle-time Do u have any idea on this – Pinki Jun 02 '11 at 06:42