Starting activity from service on lock screen turns on the screen but does not show the activity itself

I'm facing the same problem, after a lot of searching here and google, found this which unlocked the screen and popped my activity but it only works for me when the app is running (foreground/background).

import android.view.Window;
import android.view.WindowManager.LayoutParams;


Window window = this.getWindow();
window.addFlags(LayoutParams.FLAG_DISMISS_KEYGUARD);
window.addFlags(LayoutParams.FLAG_SHOW_WHEN_LOCKED);
window.addFlags(LayoutParams.FLAG_TURN_SCREEN_ON);

i'm trying to start an activty when app is closed... (using broadcast receiver)

in the docs (for example here) and most of the answers on SO the flags are added this way:

 getWindow().addFlags(WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD); 

but when i tried the way it is like in the example it unlocked the screen instead of just turning on the screen.

hope this help . it still didn't solve my problem completely.

EDIT:

found this post which solved my problem.

there is a comment there on NOT using a dialog theme which solved it for me