capacitor-plugin-check-overlay
v0.0.4
Published
This plugin is an Android plugin that checks for any installed overlay apps on the device. It can be used to enhance user's security by providing a warning if any apps are granted permission to draw overlay layers above other apps on the screen.
Downloads
7
Readme
capacitor-plugin-check-overlay
This plugin is an Android plugin that checks for any installed overlay apps on the device. It can be used to enhance user's security by providing a warning if any apps are granted permission to draw overlay layers above other apps on the screen.
Install
npm install capacitor-plugin-check-overlay
npx cap sync
Example
import { CheckOverlay } from 'capacitor-plugin-check-overlay';
constructor(private platfrom: Platform) {
this.platfrom.ready().then(() => {
// Add blacklist
const blacklist = [
'com.urbandroid.lux:Twilight',
'com.paget96.bluelightfilter:Blue Light Filter - Night Light',
'com.ascendik.eyeshield:Night Shift',
'com.sisomobile.android.brightness:sFilter',
'com.mlhg.screenfilter:Darker',
'com.digipom.nightfilter:Night Filter',
'com.github.ericytsang.screenfilter.app.android:Screen Dimmer',
'com.yaojian.protecteye:Eye Protect',
'jp.snowlife01.android.bluelightfilter0:Blue light filter',
'jp.ne.hardyinfinity.bluelightfilter.free:Bluelight Filter',
];
this.checkOverlayApps(blacklist);
// without blacklist, detect all app that request Overlay Permission
this.checkOverlayApps([]);
}
)
}
checkOverlayApps = async (blackList: Array<string>) => {
const checkResult = await CheckOverlay.checkOverlayApps({ blackList });
console.log('checkOverlayApps Result:');
console.log('Has Overlay: ', checkResult.hasOverlay);
console.log('Messages: ', checkResult.message);
console.log('Overlay Apps: ', checkResult.overlayApps.join("\n"));
};
API
checkOverlayApps(...)
checkOverlayApps(options: { blackList: Array<string>; }) => Promise<CheckOverlayAppsResult>
| Param | Type | Description |
| ------------- | ------------------------------------- | -------------------------------------------- |
| options
| { blackList: string[]; } | : Array<string> } |
Returns: Promise<CheckOverlayAppsResult>
Interfaces
CheckOverlayAppsResult
| Prop | Type |
| ----------------- | ----------------------------------------------------- |
| hasOverlay
| boolean |
| message
| string |
| overlayApps
| Array<string> |