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
3 Answers
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()
.

- 64,273
- 8
- 118
- 148
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

- 1
- 1

- 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