Reputation: 2342
I am stuck and working on android app, i want when i close my application,then if user do not touch screen for x time, for example for 1minute user do not touch the screen or use the device then my application start automatically after x time..how i can achieve this please help..Thanks
Upvotes: 1
Views: 399
Reputation: 3596
You could make use of service. As soon as your application is exited you could start a timer or counter. If there are no interactions on phone by the user you could start your activity from ur service (or) You could implement ur service in such a way that when the phone is going into sleep mode(which means there was no interaction by the user on the phone) you can start your activity.
UPDATED
protected CountDownTimer timer = new CountDownTimer(5000, 5000){
@Override
public void onTick(long millisUntilFinished) {
Log.d("onTick", "Entered");
}
@Override
public void onFinish() {
Log.d("onFinish", "Entered");
}
};
Upvotes: 4