Nom1fan Nom1fan - 1 year ago 317
Android Question

StandOut window not shown during incoming call when key guard is set in Marshmallow

I am using Mark Wei's incredible library StandOut in my app:

What I am doing is very similar to TrueCaller App

Which is displaying my own view upon an incoming call.
This generally works great.

What is my problem?

On a very specific case:

  • On Android Marshmallow (6) only

  • When key guard lock is set ON

Then the app's StandOut window is sent back behind the incoming call window and is not shown except for a flicker for a fraction of a second.

What have I tried?

Using both these flags together:



In addition (and separately) I tried this deprecated way:

KeyguardManager.KeyguardLock mLock;
KeyguardManager mKeyguardManager = (KeyguardManager)getSystemService(Activity.KEYGUARD_SERVICE);
mLock = mKeyguardManager.newKeyguardLock(KEYGUARD_SERVICE);

When this also failed, I tried granting my app Administrator privileges (I won't add the whole code to do it as it's long but I did it properly) and then tried this:


NOTE: I want to stress again that I know this is possible since TrueCaller App Is doing it so well and does not fail on every call. Just need help to find the right way to do it.

Thanks in advance!

Answer Source

I have three suggestions for you to try, (not sure if they will work), but they are worth a try.

  1. try to add these flags:

  2. try to add a delay of let's say 2 seconds before you fire the StandOut window activity to make sure it is coming after the incoming call system screen (later, if this solves the issue, reduce the delay as much as possible).

  3. Also found this answer here, not sure if you have access to the window properties, but saw this solution:

    "We were also facing similar issue that the overlay was not displayed on a device with pin lock. The solution that worked for us is below:

    mWindowManager = (WindowManager) getSystemService(WINDOW_SERVICE);
        mParams = new LayoutParams(

    It was

    that made the difference."

    The question that is similar: Pop up window over Android native incoming call screen like true caller Android app

Hope that something here is helpful to you, please update if solved.

UPDATE: This was solved the issue: (adding this):


Just make sure to add this before the layout is inflated, otherwise it will do nothing.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download