メインコンテンツまでスキップ
Version: v6

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?

Don't waste precious time on plugin issues.

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

$ npm install cordova-plugin-android-notch 
$ npm install @awesome-cordova-plugins/android-notch
$ ionic cap sync

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))