1

I am trying to show view when there is an incoming phone call. This view should be touchable/draggable, but it shouldn't block touches outside of this view(user should still be able to reject/answer call). This view should also appear when phone is locked and call is incoming over the lockscreen.

I am able to create view(from service) that is draggable(using LayoutParams.TYPE_PRIORITY_PHONE but this view doesn't show when the phone is locked. When i use LayoutParams.TYPE_SYSTEM_OVERLAY this view isn't draggable/touchable.

So my question is, is there a way to achieve this behaviour: touchable/draggable view that appears everytime on top when call is incoming(also when call is shown over lock screen) and doen't block touch outside of this view. Which type should i use to achieve this?

This is how I add view, using WindowManager.

 params = new WindowManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT,
                    WindowManager.LayoutParams.TYPE_PRIORITY_PHONE  ,
                    WindowManager.LayoutParams.FLAG_DISMISS_KEYGUARD |
                    WindowManager.LayoutParams.FLAG_SHOW_WHEN_LOCKED |
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |
                    WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON |
                    WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH |
                    WindowManager.LayoutParams.FLAG_TURN_SCREEN_ON,
            PixelFormat.RGBA_8888);


    params.height = ViewGroup.LayoutParams.WRAP_CONTENT;
    params.width = ViewGroup.LayoutParams.MATCH_PARENT;
    params.x = 0;
    params.y = 0;

    //Add layout to window
    wm.addView(layout, params);

Thank you for every advice:).

ShadeSVK
  • 11
  • 3

0 Answers0