@thedesolatesould: it is exactly like NJDude mentioned, I just meant the dialer screen when you receive a call. The dialer screen's usual behaviour is to be always in front of all other apps. So the solution to be used is BroadcastReceiver (exactly like NJDude mentioned). I did my app in that way.
Your question, however, is very interesting for me. I have the same question that I have asked Erel before but I don't have yet answer.
Do you know how to display the window in front of selective apps and not all?
I cannot know the solution how to send my window in front of a selective app, but I do see many other apps can do, for example the app locker or protector. Let say you have an app named ABC. If you select ABC in the "protect list" of the Protector, every time when you run ABC, Protector will pop up a "locked screen" in front of ABC. And you have to enter the PIN to access ABC.
An idea just came in my mind is to use a timer and periodically check if ABC (or Google Map) is running then we can popup the StandOut in front of it? But the following piece of code only can tell us when ABC is running, I am not sure if this code can tell us ABC is in front. I need to test.
Sub FindRunningProgram (Package As String)
Dim sb As StringBuilder
sb.Initialize
Dim Phone As Phone
Phone.Shell("ps", Null, sb, Null)
Log(sb.ToString)
Dim m As Matcher
m = Regex.Matcher2("^[^ ]*\s+(\d+) .*" & Package, Regex.MULTILINE, sb.ToString)
If m.Find Then
Log(Package & " is running")
Return True
Else
Log(Package & " is NOT running")
Return False
End If
End Sub