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 @awesome-cordova-plugins/android-notch
$ ionic cap sync
$ ionic cordova plugin add cordova-plugin-android-notch
$ npm install @awesome-cordova-plugins/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
React
Learn more about using Ionic Native components in React
Angular
import { AndroidNotch } from '@awesome-cordova-plugins/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))