android - Handler not workig when device is locked screen -


activity open when device lock screen problem inside activity using handler showing dialog not working. handler working when device unlock dialog showing.my problem when device screen unlock want start handler inside activity showing dialog.

here code:

protected void oncreate(bundle savedinstancestate) {         requestwindowfeature(window.feature_no_title);         wind = this.getwindow();        wind.addflags(windowmanager.layoutparams.flag_dismiss_keygua‌​rd);         wind.addflags(windowmanager.layoutparams.flag_show_when_lock‌​ed);         wind.addflags(windowmanager.layoutparams.flag_turn_screen_on‌​);          wind.addflags(windowmanager.layoutparams.flag_fullscreen);         setcontentview(r.layout.activity_incoming_call);         mhandler_calldismiss=new handler();         mhandler_calldismiss.postdelayed(runnable,30000); } 

in activity, befor lock, calls onpause() , after unlock , calls onresume(). can write handler code in onresume() functions

  1. the user opens activity.
  2. oncreated() called
  3. onstart() called
  4. onresume() called
  5. the user locks device onpause called()
  6. the user unlocks device onresume() called

Comments

Popular posts from this blog

php - Vagrant up error - Uncaught Reflection Exception: Class DOMDocument does not exist -

vue.js - Create hooks for automated testing -

Add new key value to json node in java -