Android Notch
This plugin enables developers to get the cutout and android devices inset sizes It is based on the cordova plugin developed by @tobspr: https://github.com/tobspr/cordova-plugin-android-notch This plugin works on all android versions, but we can only detect notches starting from Android 9.
https://github.com/tobspr/cordova-plugin-android-notch.git
Stuck on a Cordova issue?
If you're building a serious project, you can't afford to spend hours troubleshooting. Ionic’s experts offer premium advisory services for both community plugins and premier plugins.
Installation#
- Capacitor
- Cordova
- Enterprise
$ npm install cordova-plugin-android-notch $ npm install @ionic-native/android-notch $ ionic cap sync
$ ionic cordova plugin add cordova-plugin-android-notch $ npm install @ionic-native/android-notch
Ionic Enterprise comes with fully supported and maintained plugins from the Ionic Team. Learn More or if you're interested in an enterprise version of this plugin Contact Us
#
Supported Platforms- Android
#
Usage#
ReactLearn more about using Ionic Native components in React
#
Angularimport { AndroidNotch } from '@ionic-native/android-notch/ngx';
constructor(private androidNotch: AndroidNotch) { }
...
this.androidNotch.hasCutout() .then((px: number) => console.log('Inset size: '), px) .catch((error: any) => console.log('Error: ', error))
this.androidNotch.getInsetTop() .then((px: number) => console.log('Inset size: '), px) .catch((error: any) => console.log('Error: ', error))
this.androidNotch.getInsetRight() .then((px: number) => console.log('Inset size: '), px) .catch((error: any) => console.log('Error: ', error))
this.androidNotch.getInsetBottom() .then((px: number) => console.log('Inset size: '), px) .catch((error: any) => console.log('Error: ', error))
this.androidNotch.getInsetLeft() .then((px: number) => console.log('Inset size: '), px) .catch((error: any) => console.log('Error: ', error))