1

How can I disable users can swipe down the title/notification bar as seen in the picture below. I want my app run in kiosk mode and my users must not be able to swipe down or anything else.

I tried using setting some flags but all I get is some kind of kiosk mode but users can still view the wifi/airplane etc screen on swipe down.

Please help, I can not find a good answer on Stackoverflow

I don not want my users can see the screen below.

enter image description here

baliman
  • 588
  • 2
  • 8
  • 27
  • 1
    Does this answer your question? [How to disable status bar click and pull down in Android?](https://stackoverflow.com/questions/29969086/how-to-disable-status-bar-click-and-pull-down-in-android) – Rajnish Sharma Jul 19 '20 at 10:54

1 Answers1

0

Refer to this answer here

or

 private void disablePullNotificationTouch() {
            WindowManager manager = ((WindowManager) getApplicationContext()
                    .getSystemService(Context.WINDOW_SERVICE));
            WindowManager.LayoutParams localLayoutParams = new WindowManager.LayoutParams();
            localLayoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ERROR;
            localLayoutParams.gravity = Gravity.TOP;
            localLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE |

                    // this is to enable the notification to recieve touch events
                    WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL |

                    // Draws over status bar
                    WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN;

            localLayoutParams.width = WindowManager.LayoutParams.MATCH_PARENT;
            localLayoutParams.height = (int) (25 * getResources()
                    .getDisplayMetrics().scaledDensity);
            localLayoutParams.format = PixelFormat.RGBX_8888;
            customViewGroup view = new customViewGroup(this);
            manager.addView(view, localLayoutParams);
        }

//Add this class in your project
public class customViewGroup extends ViewGroup {

    public customViewGroup(Context context) {
        super(context);
    }

    @Override
    protected void onLayout(boolean changed, int l, int t, int r, int b) {
    }

    @Override
    public boolean onInterceptTouchEvent(MotionEvent ev) {

        Log.v("customViewGroup", "**********Intercepted");
        return true;
    }
Rajnish Sharma
  • 390
  • 2
  • 14