0.0.3 • Published 5 months ago
root-detection-plugin v0.0.3
Root Detection Plugin for Capacitor
A Capacitor plugin for detecting root access on Android and jailbreak status on iOS. It also provides a fallback implementation for the web.
Features
- Android: Detects root access using various checks like root management apps, su binary, dangerous system properties, etc.
- iOS: Detects jailbreak status based on file system checks.
- Web: Always returns
false
, as root detection is not applicable.
Installation
Install the plugin using npm:
npm install root-detection-plugin
npx cap sync
Usage
Import the plugin in your Capacitor/Ionic app:
import { RootDetection } from 'root-detection-plugin';
async function checkRootStatus() {
try {
const result = await RootDetection.isDeviceRooted();
console.log('Rooted:', result.rooted);
console.log('Reason:', result.reason);
} catch (error) {
console.error('Error checking root:', error);
}
}
API
isDeviceRooted()
Detects whether the device is rooted (Android) or jailbroken (iOS).
Returns:
Promise<{ rooted: boolean; reason: string }>
Example Response:
{
"rooted": true,
"reason": "su binary found at: /system/bin/"
}
Platform Support
Platform | Supported |
---|---|
Android | ✅ Yes |
iOS | ✅ Yes |
Web | ✅ Returns false |
License
MIT License