Skip to content

Capacitor plugin to prevent tap jacking on Android devices

Notifications You must be signed in to change notification settings

capacitor-community/tap-jacking

Repository files navigation


Tap Jacking

@capacitor-community/tap-jacking

Tap Jacking is a technique where a malicious app tricks the user into clicking a security-relevant control (confirmation button etc.) by obscuring the UI with an overlay or by other means.

This plugin prevents tap jacking by calling setFilterTouchesWhenObscured(true) (Android 11 and below) or setHideOverlayWindows (Android 12+) as described in the Android Developer Documentation.

On iOS and web this call does nothing.

Install

npm install @capacitor-community/tap-jacking
npx cap sync

Usage

import { TapJacking } from '@capacitor-community/tap-jacking';
...
await TapJacking.preventOverlays();

API

preventOverlays()

preventOverlays() => Promise<void>

enableOverlays()

enableOverlays() => Promise<void>