I am writing a sip
based calling application. When there is an incoming call the corresponding activity for it is fired and is getting displayed below the lock screen. But the user doesn't get to know about the call...the lock screen comes up for a while and screen turns off..even when the call is still ringing...the ringtone is active for the entire duration but screen doesn't show the incoming call UI. I need to find a way to display the appropriate UI and keep screen on for the whole duration of incoming call...
For the part of keeping the screen on for the whole duration of incoming call I am using wakelocks...but I am not able to get rid of the lock screen...
I researched and found that can use KeygaurdManager
or WindowManager.LayoutParams
with appropriate flags like FLAG_KEEP_SCREEN_ON
, FLAG_DISMISS_KEYGAURD
, FLAG_SHOW_WHEN_LOCKED
and FLAG_TURN_SCREEN_ON
to unlock the phone...however these don't work in my case...I read in one of the following links that one cannot unlock the phone when the phone is password/pattern locked...is this the issue why i am unable to display the UI i want? How does it work for incoming phone calls? Please suggest me some solutions
The links that i referred to are
How can I unlock the screen programmatically in Android?
How do I prevent an Android device from going to sleep programmatically?
unlock screen while in call android
Android: Turn screen ON and notify user
How to launch an activity when lock screen is enabled?
Android activity over default lock screen
Android Create An Activity That Float Over Lockscreen
Unlock Android phone programmatically?
How to display Activity when the screen is locked?
How to unlock the device when my activity will be launched programmatically?
Android: How to turn screen on and off programmatically?
How to show incoming call notification in android application
How to display Activity when the screen is locked?
How unlock and lock screen programatically in android
How to unlock the device when my activity will be launched programmatically?
How to notify SIP client when there is an incoming call on another phone
Thanks in advance.
For me following code works well.
Remember to add permission as well
<uses-permission android:name="android.permission.DISABLE_KEYGUARD" />