android - Activity not shown through LockScreen -


i trying show activity through lockscreen. second 1 in app, first 1 works without problem. using wakelock :

powermanager pm = (powermanager)getsystemservice(context.power_service);     //mwakelock = pm.newwakelock(powermanager.partial_wake_lock, tag);     mwakelock = pm.newwakelock(powermanager.partial_wake_lock, tag);     mwakelock.acquire(); 

and using expected code within activity

"getwindow().addflags(windowmanager.layoutparams.flag_dismiss_keyguard             | windowmanager.layoutparams.flag_turn_screen_on             | windowmanager.layoutparams.flag_keep_screen_on); 

i tried option :

windowmanager.layoutparams lp = getwindow().getattributes();     lp.flags |= windowmanager.layoutparams.flag_show_when_locked;     lp.flags |= windowmanager.layoutparams.flag_dismiss_keyguard;     lp.flags |= windowmanager.layoutparams.flag_turn_screen_on;     lp.flags |= windowmanager.layoutparams.flag_keep_screen_on;     getwindow().setattributes(lp); 

the big difference between 2 activities when shown. first 1 (the 1 thats's working) reacts on android.provider.telephony.sms_received broadcast, whilst second 1 on intent.action_power_connected broadcast.

why wouldn't second 1 work ? lockscreen not removed show activity, if swipe lockscreen away activity showing right beneath it. might plugging power in not interceptable ?

/edit :

i did discover difference between 2 activities : 1 not work has theme based on dialog theme.

<style name="themewithcorners" parent="android:theme.holo.light.dialog"> 

if remove works fine, question how dialog-theme based activity behave in same manner ???

/edit2: after more googling , searching found piece of code works :

keyguardmanager keymgr = (keyguardmanager) getsystemservice(keyguard_service);     keyguardmanager.keyguardlock keylock = keymgr.newkeyguardlock(tag);     keylock.disablekeyguard(); 

the bad thing newkeyguardlock() method has been deprecated. might not work anymore in future releases (tested on 4.1.2). if knows right way accompish same feat ?


Comments

Popular posts from this blog

database - VFP Grid + SQL server 2008 - grid not showing correctly -

jquery - Set jPicker field to empty value -

.htaccess - htaccess convert request to clean url and add slash at the end of the url -