Android Question Popup window while phone is locked

Shay

Well-Known Member
Licensed User
I wish to popup window while incoming call.
while phone is off + locked, once call is incoming I am getting andriod "incoming call screen"
but my popup is not coming. (toastmessage are appearing)
I know it is possible since "TrueCaller" app is doing it - I am getting their popup even if my phone is locked.
how do I do it?
 

MarkusR

Well-Known Member
Licensed User
truecaller have this permission "disable your screen lock"
i read some apps disable and replace the lock screen to act free.

you can register for some events with this lib
https://www.b4x.com/android/help/phone.html
 

Shay

Well-Known Member
Licensed User
How do I do it? (disable the lock) - I have lock with password / fingerprint
 

Shay

Well-Known Member
Licensed User
Thanks, but this is not helping.
Best case I am seeing my screen for half second till incoming call screen appears
I am using all of these flags:
B4X:
    Window.RunMethod("addFlags", Array As Object(131072)) 'FLAG_NOT_FOCUSABLE
    Window.RunMethod("addFlags", Array As Object(16)) 'FLAG_NOT_TOUCHABLE
    Window.RunMethod("addFlags", Array As Object(32)) 'FLAG_NOT_TOUCH_MODAL
    Window.RunMethod("addFlags", Array As Object(128)) 'FLAG_KEEP_SCREEN_ON
    Window.RunMethod("addFlags", Array As Object(4194304 )) 'FLAG_DISMISS_KEYGUARD
    Window.RunMethod("addFlags", Array As Object(524288)) 'FLAG_SHOW_WHEN_LOCKED
    Window.RunMethod("addFlags", Array As Object(2097152 )) 'FLAG_TURN_SCREEN_ON
 

wes58

Active Member
Licensed User
Thanks, but this is not helping.
Best case I am seeing my screen for half second till incoming call screen appears
What you wrote make sense to me. I think that's how it should work.
Your screen appears ON TOP of the lock screen. Then incoming call screen shows, and it appears ON TOP of your screen.
If they have similar settings/permissions - i.e. show on top of other windows, it makes sense that that last popup/screen that shows, will be on top of the previous one.

What will happen if after incoming screen shows, you try to show your screen again? Will it be on top?
 

wes58

Active Member
Licensed User
My answer was only relevant to showing an activity before the lock screen.

If you want draw over other apps you need to handle the special permission: https://www.b4x.com/android/forum/threads/draw-on-top-of-other-apps-permission.90513/#content
Search for: SYSTEM_ALERT_WINDOW
There are a few threads about this feature.
This is true if running it on API 23 - 25.
If using API26 then there are some changes (as usual with every new upgrade Google is making life difficult) - see this https://stackoverflow.com/questions...api-26-not-working-as-expected-permission-den and this https://developer.android.com/about/versions/oreo/android-8.0-changes
Alert windows
If an app uses the SYSTEM_ALERT_WINDOW permission and uses one of the following window types to attempt to display alert windows above other apps and system windows:

...then these windows always appear beneath the windows that use the TYPE_APPLICATION_OVERLAY window type. If an app targets Android 8.0 (API level 26), the app uses the TYPE_APPLICATION_OVERLAY window type to display alert windows.
 

Shay

Well-Known Member
Licensed User
so what is the suggestion for me, to handle this?
maybe I can force the screen to split and the incoming call screen will appear up, and my window down the screen? (is it possible?)
 

Shay

Well-Known Member
Licensed User
b.t.w - again, this below solution seems to work, it draws background screen on top of the incoming call screen (and stays even if I am getting call / phone is locked)
https://www.b4x.com/android/forum/threads/screen-blue-filter-resolved.77335/#post-489936
and it stays like this (yes it is crashing with sdk 26, but with sdk 23 it is fine)
so what I need to do is either to load my layout on top of this code, or native draw labels and imageview on it (which I don't know how to do it in java).
any suggestions?
 

Erel

Administrator
Staff member
Licensed User
and it stays like this (yes it is crashing with sdk 26, but with sdk 23 it is fine)
You will not be able to submit your app to Google Play without setting targetSdkVersion to 26.
Drawing over other apps is a problematic feature. I don't think that there is any library available that will work properly on new devices.
 
Top