2

A problem I am facing that I have to hide all notification on lock screen on os 8.

Functionality: I have to develop lock screen and no other app will use when the lock screen is on the foreground.

Let me explain the whole problem:

1) I have developed custom lock screen. Please see below code

public WindowManager winManager;
    public RelativeLayout wrapperView;

    // Adding a View on Top
            WindowManager.LayoutParams localLayoutParams;
            if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
                localLayoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY,
                        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        PixelFormat.TRANSLUCENT);
            } else {
                localLayoutParams = new WindowManager.LayoutParams(WindowManager.LayoutParams.TYPE_SYSTEM_ERROR,
                        WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_FULLSCREEN,
                        PixelFormat.TRANSLUCENT);
            }
            this.winManager = ((WindowManager) getApplicationContext().getSystemService(WINDOW_SERVICE));
            this.wrapperView = new RelativeLayout(getBaseContext());
            this.wrapperView.setBackgroundColor(getResources().getColor(R.color.white));
            getWindow().setAttributes(localLayoutParams);

            View.inflate(this, R.layout.lock_screen_activity, this.wrapperView);
            this.winManager.addView(this.wrapperView, localLayoutParams);

It perfectly works on OS 7 and below. Notification access is not available on custome lock screen. But on OS 8, on the lock screen other app notification is display as per category. and user can reply in notification. So that i have to prevent on lock screen.

app Gradle like:
minSdkVersion 19
targetSdkVersion 26

I have already tried below option :
https://developer.android.com/training/system-ui/status

Please guys help me to solve this problem. Thank you in advance...

Hemant Parmar
  • 3,924
  • 7
  • 25
  • 49
  • try this: https://stackoverflow.com/questions/19920052/disable-the-notification-panel-from-being-pulled-down hope you get solution – Dhruti Mistry May 28 '18 at 06:23
  • Thanks for the help. I have tried but didn't work. It still displays the notification and dragging down notification panel is also display. – mrugen patel May 28 '18 at 07:06

0 Answers0