java - what to use for automatic signout of an App after 30 min in android -
i want application automatically signout after 30 minutes.so confused lots of option have. 1.handlers think if use handler won't calculate display sleep time , can not able resume handler in activity. 2.alarmmanager dont know think use more cpu memory. 3.countdownmanager how used below
new countdowntimer(40000, 1000) { //40000 milli seconds total time, 1000 milli seconds time interval public void ontick(long millisuntilfinished) { } public void onfinish() { } }.start(); but can resume countdownmanager process in activity 4.timer in java create thread
or nessesary should use service , include 1 of above methods.because there possibility user can press home button , app goes onpause() state.or display can sleep after time.i dont want app slow down .will using service slow down app.can me.
use alarammanager , set alarm after 30 minute. , have use pending intent service called after 30 minute. , can code there.
you can see how set alarm programetically?
and if wants idle time if gets touch or focus can reset alarm.
and screen off can write code @ onpause , onresume.
Comments
Post a Comment