In my application am using services move to another activity after ten minutes even the screen in off,screen locked.
my problem Service is run when screen is in ON condition,but in screen OFF or when lock the screen condition means the service is stopped after i unlock the screen means service start from there.i don't know how to do this thing.Can any one know please help me to solve this problem.
My service time coding
public class Time_out_services extends Service {
Handler mHandler;
@Override
public int onStartCommand(Intent intent, int flags, int startId) {
//TODO do something useful
mHandler = new Handler();
mHandler.postDelayed(first_Task, 4 * 60 * 1000);
return Service.START_NOT_STICKY;
}
Runnable first_Task = new Runnable() {
public void run() {
mHandler = new Handler();
Intent i = new Intent();
i.setClass(Time_out_services.this, Dialog_actvity.class);
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(i);
stopSelf();
}
}
};
@Override
public IBinder onBind(Intent intent) {
// TODO Auto-generated method stub
return null;
}
}