android - Phone light Turn On when incoming call come -
i got incoming call , working well. when screen turn off , incoming call come. screen light not on. using code in oncreate():-
getwindow().addflags( windowmanager.layoutparams.flag_allow_lock_while_screen_on | windowmanager.layoutparams.flag_show_when_locked ); powermanager pm = (powermanager) getsystemservice(context.power_service); wl = pm.newwakelock(powermanager.screen_bright_wake_lock, "my tag"); wl.acquire();
also when screen light on , incoming call come connection server successful. when screen light off , incoming call come(by service run in background registration server) registration failed .
please android expert me!
use following in oncreate
getwindow().addflags(windowmanager.layoutparams.flag_dismiss_keyguard); getwindow().addflags(windowmanager.layoutparams.flag_show_when_locked); getwindow().addflags(windowmanager.layoutparams.flag_turn_screen_on); getwindow().addflags(windowmanager.layoutparams.flag_keep_screen_on);
and use permission
<uses-permission android:name="android.permission.wake_lock" > </uses-permission> <uses-permission android:name="android.permission.disable_keyguard" > </uses-permission>
Comments
Post a Comment