2

I've an app with an overlay and I need to check if the device has a notch or not.

Normally you use the activity and call following:

activity.getWindow().getDecorView().getRootWindowInsets().getDisplayCutout()

Any alternative way to check for a notch that also works in a service? I need to adjust my overlay if the device has a notch...

Any way to find out if the device has a notch or not if I can only access the WindowManager?

prom85
  • 16,896
  • 17
  • 122
  • 242
  • Check my answer here https://stackoverflow.com/a/53593067/10477142 – Sachin Jagtap Aug 09 '19 at 05:45
  • Thanks, this may help, but is no bullet proof solution. E.g. you can modify statusbar height on rooted devices to whatever you want - many custom ROMs offer small patches for this... And I would not rely on the assumption you make, although the assumption that all devices without notches have a statusbar height of 24dp may be true for all devices (not sure though, manufactures don't always follow googles design suggestions). – prom85 Aug 12 '19 at 07:48

0 Answers0