1

I am working on VOIP call application. When an incoming call appears upto android version 5.0 the incoming call appears on top to Lockscreen when but from version 6.0 onwards it is showing as notification. Call screen not appearing.

After doing some R&D added the following below code before setContentVies(),

getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);

But still facing the same problem. Can anyone please suggest me how to display VOIP incoming call on top of lock screen.

user2384424
  • 187
  • 1
  • 3
  • 13

1 Answers1

3

After receiving the VOIP push notification on my receiver I launch my custom incoming call Activity, that overrides the onAttachedToWindow method like this:

@Override
public void onAttachedToWindow() {
    super.onAttachedToWindow();
    getWindow().addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON|
            WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD|
            WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED|
            WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON);
}

This works fine for me in Android 4.4 up to Android 8.0, I haven't tried it so far in others OS versions. I am able to receive the incoming custom calls from my app on top of both locked and unlocked screen.

xyz
  • 524
  • 10
  • 22